eslint-plugin-oxlint
Advanced tools
Comparing version 0.15.2 to 0.15.4
@@ -1,2 +0,2 @@ | ||
import { OxlintConfig, OxlintConfigPlugins } from './types.js'; | ||
import { OxlintConfig, OxlintConfigOverride, OxlintConfigPlugins } from './types.js'; | ||
/** | ||
@@ -6,2 +6,2 @@ * tries to return the "plugins" section from the config. | ||
*/ | ||
export declare const readPluginsFromConfig: (config: OxlintConfig) => OxlintConfigPlugins | undefined; | ||
export declare const readPluginsFromConfig: (config: OxlintConfig | OxlintConfigOverride) => OxlintConfigPlugins | undefined; |
@@ -1,2 +0,2 @@ | ||
import { OxlintConfig, OxlintConfigRules } from './types.js'; | ||
import { OxlintConfig, OxlintConfigOverride, OxlintConfigRules } from './types.js'; | ||
/** | ||
@@ -10,2 +10,2 @@ * checks if the oxlint rule is activated/deactivated and append/remove it. | ||
*/ | ||
export declare const readRulesFromConfig: (config: OxlintConfig) => OxlintConfigRules | undefined; | ||
export declare const readRulesFromConfig: (config: OxlintConfig | OxlintConfigOverride) => OxlintConfigRules | undefined; |
@@ -7,2 +7,7 @@ import { Linter } from 'eslint'; | ||
export type EslintPluginOxlintConfig = Linter.Config<Record<string, 'off'>>; | ||
export type OxlintConfigOverride = { | ||
files: string[]; | ||
plugins?: OxlintConfigPlugins; | ||
rules?: OxlintConfigRules; | ||
}; | ||
export type OxlintConfig = { | ||
@@ -9,0 +14,0 @@ [key: string]: unknown; |
@@ -15,2 +15,3 @@ declare const configByCategory: { | ||
readonly 'no-inner-declarations': "off"; | ||
readonly 'no-negated-condition': "off"; | ||
readonly 'no-new-wrappers': "off"; | ||
@@ -53,3 +54,2 @@ readonly 'no-object-constructor': "off"; | ||
readonly 'unicorn/no-lonely-if': "off"; | ||
readonly 'unicorn/no-negated-condition': "off"; | ||
readonly 'unicorn/no-negation-in-equality-check': "off"; | ||
@@ -161,7 +161,10 @@ readonly 'unicorn/no-new-buffer': "off"; | ||
readonly 'no-duplicate-imports': "off"; | ||
readonly 'no-extra-label': "off"; | ||
readonly 'no-label-var': "off"; | ||
readonly 'no-labels': "off"; | ||
readonly 'no-magic-numbers': "off"; | ||
readonly 'no-multi-assign': "off"; | ||
readonly 'no-multi-str': "off"; | ||
readonly 'no-nested-ternary': "off"; | ||
readonly 'no-new-func': "off"; | ||
readonly 'no-restricted-imports': "off"; | ||
readonly 'no-return-assign': "off"; | ||
@@ -174,7 +177,10 @@ readonly 'no-script-url': "off"; | ||
readonly 'prefer-object-has-own': "off"; | ||
readonly 'prefer-rest-params': "off"; | ||
readonly 'prefer-spread': "off"; | ||
readonly 'sort-imports': "off"; | ||
readonly 'sort-keys': "off"; | ||
readonly 'vars-on-top': "off"; | ||
readonly yoda: "off"; | ||
readonly 'import/first': "off"; | ||
readonly 'import/no-named-default': "off"; | ||
readonly 'import/no-namespace': "off"; | ||
@@ -238,3 +244,2 @@ readonly 'jest/consistent-test-it': "off"; | ||
readonly '@typescript-eslint/no-magic-numbers': "off"; | ||
readonly '@typescript-eslint/no-restricted-imports': "off"; | ||
readonly '@typescript-eslint/prefer-for-of': "off"; | ||
@@ -335,3 +340,2 @@ readonly '@typescript-eslint/prefer-function-type': "off"; | ||
readonly 'import/default': "off"; | ||
readonly 'import/named': "off"; | ||
readonly 'import/namespace': "off"; | ||
@@ -378,2 +382,3 @@ readonly 'jest/expect-expect': "off"; | ||
readonly 'jsx-a11y/no-distracting-elements': "off"; | ||
readonly 'jsx-a11y/no-noninteractive-tabindex': "off"; | ||
readonly 'jsx-a11y/no-redundant-roles': "off"; | ||
@@ -380,0 +385,0 @@ readonly 'jsx-a11y/prefer-tag-over-role': "off"; |
@@ -52,2 +52,3 @@ declare const configByScope: { | ||
readonly 'no-extra-boolean-cast': "off"; | ||
readonly 'no-extra-label': "off"; | ||
readonly 'no-fallthrough': "off"; | ||
@@ -62,5 +63,9 @@ readonly 'no-func-assign': "off"; | ||
readonly 'no-label-var': "off"; | ||
readonly 'no-labels': "off"; | ||
readonly 'no-loss-of-precision': "off"; | ||
readonly 'no-magic-numbers': "off"; | ||
readonly 'no-multi-assign': "off"; | ||
readonly 'no-multi-str': "off"; | ||
readonly 'no-negated-condition': "off"; | ||
readonly 'no-nested-ternary': "off"; | ||
readonly 'no-new': "off"; | ||
@@ -79,3 +84,2 @@ readonly 'no-new-func': "off"; | ||
readonly 'no-restricted-globals': "off"; | ||
readonly 'no-restricted-imports': "off"; | ||
readonly 'no-return-assign': "off"; | ||
@@ -112,2 +116,3 @@ readonly 'no-script-url': "off"; | ||
readonly 'prefer-object-has-own': "off"; | ||
readonly 'prefer-rest-params': "off"; | ||
readonly 'prefer-spread': "off"; | ||
@@ -124,2 +129,3 @@ readonly radix: "off"; | ||
readonly 'valid-typeof': "off"; | ||
readonly 'vars-on-top': "off"; | ||
readonly yoda: "off"; | ||
@@ -134,3 +140,2 @@ }; | ||
readonly 'import/max-dependencies': "off"; | ||
readonly 'import/named': "off"; | ||
readonly 'import/namespace': "off"; | ||
@@ -145,2 +150,3 @@ readonly 'import/no-amd': "off"; | ||
readonly 'import/no-named-as-default-member': "off"; | ||
readonly 'import/no-named-default': "off"; | ||
readonly 'import/no-namespace': "off"; | ||
@@ -253,2 +259,3 @@ readonly 'import/no-self-import': "off"; | ||
readonly 'jsx-a11y/no-distracting-elements': "off"; | ||
readonly 'jsx-a11y/no-noninteractive-tabindex': "off"; | ||
readonly 'jsx-a11y/no-redundant-roles': "off"; | ||
@@ -395,3 +402,2 @@ readonly 'jsx-a11y/prefer-tag-over-role': "off"; | ||
readonly '@typescript-eslint/no-require-imports': "off"; | ||
readonly '@typescript-eslint/no-restricted-imports': "off"; | ||
readonly '@typescript-eslint/no-this-alias': "off"; | ||
@@ -445,3 +451,2 @@ readonly '@typescript-eslint/no-unnecessary-type-constraint': "off"; | ||
readonly 'unicorn/no-magic-array-flat-depth': "off"; | ||
readonly 'unicorn/no-negated-condition': "off"; | ||
readonly 'unicorn/no-negation-in-equality-check': "off"; | ||
@@ -448,0 +453,0 @@ readonly 'unicorn/no-nested-ternary': "off"; |
@@ -12,2 +12,3 @@ declare const pedanticRules: { | ||
readonly 'no-inner-declarations': "off"; | ||
readonly 'no-negated-condition': "off"; | ||
readonly 'no-new-wrappers': "off"; | ||
@@ -50,3 +51,2 @@ readonly 'no-object-constructor': "off"; | ||
readonly 'unicorn/no-lonely-if': "off"; | ||
readonly 'unicorn/no-negated-condition': "off"; | ||
readonly 'unicorn/no-negation-in-equality-check': "off"; | ||
@@ -152,7 +152,10 @@ readonly 'unicorn/no-new-buffer': "off"; | ||
readonly 'no-duplicate-imports': "off"; | ||
readonly 'no-extra-label': "off"; | ||
readonly 'no-label-var': "off"; | ||
readonly 'no-labels': "off"; | ||
readonly 'no-magic-numbers': "off"; | ||
readonly 'no-multi-assign': "off"; | ||
readonly 'no-multi-str': "off"; | ||
readonly 'no-nested-ternary': "off"; | ||
readonly 'no-new-func': "off"; | ||
readonly 'no-restricted-imports': "off"; | ||
readonly 'no-return-assign': "off"; | ||
@@ -165,7 +168,10 @@ readonly 'no-script-url': "off"; | ||
readonly 'prefer-object-has-own': "off"; | ||
readonly 'prefer-rest-params': "off"; | ||
readonly 'prefer-spread': "off"; | ||
readonly 'sort-imports': "off"; | ||
readonly 'sort-keys': "off"; | ||
readonly 'vars-on-top': "off"; | ||
readonly yoda: "off"; | ||
readonly 'import/first': "off"; | ||
readonly 'import/no-named-default': "off"; | ||
readonly 'import/no-namespace': "off"; | ||
@@ -229,3 +235,2 @@ readonly 'jest/consistent-test-it': "off"; | ||
readonly '@typescript-eslint/no-magic-numbers': "off"; | ||
readonly '@typescript-eslint/no-restricted-imports': "off"; | ||
readonly '@typescript-eslint/prefer-for-of': "off"; | ||
@@ -323,3 +328,2 @@ readonly '@typescript-eslint/prefer-function-type': "off"; | ||
readonly 'import/default': "off"; | ||
readonly 'import/named': "off"; | ||
readonly 'import/namespace': "off"; | ||
@@ -366,2 +370,3 @@ readonly 'jest/expect-expect': "off"; | ||
readonly 'jsx-a11y/no-distracting-elements': "off"; | ||
readonly 'jsx-a11y/no-noninteractive-tabindex': "off"; | ||
readonly 'jsx-a11y/no-redundant-roles': "off"; | ||
@@ -368,0 +373,0 @@ readonly 'jsx-a11y/prefer-tag-over-role': "off"; |
@@ -49,2 +49,3 @@ declare const eslintRules: { | ||
readonly 'no-extra-boolean-cast': "off"; | ||
readonly 'no-extra-label': "off"; | ||
readonly 'no-fallthrough': "off"; | ||
@@ -59,5 +60,9 @@ readonly 'no-func-assign': "off"; | ||
readonly 'no-label-var': "off"; | ||
readonly 'no-labels': "off"; | ||
readonly 'no-loss-of-precision': "off"; | ||
readonly 'no-magic-numbers': "off"; | ||
readonly 'no-multi-assign': "off"; | ||
readonly 'no-multi-str': "off"; | ||
readonly 'no-negated-condition': "off"; | ||
readonly 'no-nested-ternary': "off"; | ||
readonly 'no-new': "off"; | ||
@@ -76,3 +81,2 @@ readonly 'no-new-func': "off"; | ||
readonly 'no-restricted-globals': "off"; | ||
readonly 'no-restricted-imports': "off"; | ||
readonly 'no-return-assign': "off"; | ||
@@ -109,2 +113,3 @@ readonly 'no-script-url': "off"; | ||
readonly 'prefer-object-has-own': "off"; | ||
readonly 'prefer-rest-params': "off"; | ||
readonly 'prefer-spread': "off"; | ||
@@ -121,2 +126,3 @@ readonly radix: "off"; | ||
readonly 'valid-typeof': "off"; | ||
readonly 'vars-on-top': "off"; | ||
readonly yoda: "off"; | ||
@@ -128,3 +134,2 @@ }; | ||
readonly 'import/max-dependencies': "off"; | ||
readonly 'import/named': "off"; | ||
readonly 'import/namespace': "off"; | ||
@@ -139,2 +144,3 @@ readonly 'import/no-amd': "off"; | ||
readonly 'import/no-named-as-default-member': "off"; | ||
readonly 'import/no-named-default': "off"; | ||
readonly 'import/no-namespace': "off"; | ||
@@ -238,2 +244,3 @@ readonly 'import/no-self-import': "off"; | ||
readonly 'jsx-a11y/no-distracting-elements': "off"; | ||
readonly 'jsx-a11y/no-noninteractive-tabindex': "off"; | ||
readonly 'jsx-a11y/no-redundant-roles': "off"; | ||
@@ -359,3 +366,2 @@ readonly 'jsx-a11y/prefer-tag-over-role': "off"; | ||
readonly '@typescript-eslint/no-require-imports': "off"; | ||
readonly '@typescript-eslint/no-restricted-imports': "off"; | ||
readonly '@typescript-eslint/no-this-alias': "off"; | ||
@@ -406,3 +412,2 @@ readonly '@typescript-eslint/no-unnecessary-type-constraint': "off"; | ||
readonly 'unicorn/no-magic-array-flat-depth': "off"; | ||
readonly 'unicorn/no-negated-condition': "off"; | ||
readonly 'unicorn/no-negation-in-equality-check': "off"; | ||
@@ -409,0 +414,0 @@ readonly 'unicorn/no-nested-ternary': "off"; |
{ | ||
"name": "eslint-plugin-oxlint", | ||
"version": "0.15.2", | ||
"version": "0.15.4", | ||
"description": "Turn off all rules already supported by oxlint", | ||
@@ -69,3 +69,3 @@ "type": "module", | ||
"memfs": "^4.14.0", | ||
"oxlint": "^0.15.2", | ||
"oxlint": "^0.15.4", | ||
"prettier": "^3.3.3", | ||
@@ -72,0 +72,0 @@ "scule": "^1.3.0", |
@@ -1,2 +0,2 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { assert, describe, expect, it } from 'vitest'; | ||
import { | ||
@@ -217,2 +217,76 @@ buildFromOxlintConfig, | ||
}); | ||
describe('overrides', () => { | ||
it('supports simple files + rules overrides', () => { | ||
const configs = buildFromOxlintConfig({ | ||
rules: { | ||
eqeqeq: 'warn', | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['./*.ts'], | ||
rules: { | ||
'no-alert': 'error', | ||
}, | ||
}, | ||
], | ||
}); | ||
expect(configs.length).toBe(2); | ||
assert(configs[0].rules !== undefined); | ||
expect('eqeqeq' in configs[0].rules).toBe(true); | ||
expect('no-alert' in configs[0].rules).toBe(false); | ||
assert(configs[1].rules !== undefined); | ||
expect('eqeqeq' in configs[1].rules).toBe(false); | ||
expect('no-alert' in configs[1].rules).toBe(true); | ||
}); | ||
it('supports simple files + plugins overrides', () => { | ||
const configs = buildFromOxlintConfig({ | ||
rules: { | ||
eqeqeq: 'warn', | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['./*.test.ts'], | ||
plugins: ['vitest'], | ||
}, | ||
], | ||
}); | ||
expect(configs.length).toBe(2); | ||
assert(configs[0].rules !== undefined); | ||
expect('eqeqeq' in configs[0].rules).toBe(true); | ||
expect('vitest/no-conditional-tests' in configs[0].rules).toBe(false); | ||
assert(configs[1].rules !== undefined); | ||
expect('eqeqeq' in configs[1].rules).toBe(false); | ||
expect('vitest/no-conditional-tests' in configs[1].rules).toBe(true); | ||
}); | ||
it(' rule in overrides', () => { | ||
const configs = buildFromOxlintConfig({ | ||
rules: { | ||
'no-debugger': 'warn', | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['./*.test.ts'], | ||
rules: { | ||
'no-debugger': 'off', | ||
}, | ||
}, | ||
], | ||
}); | ||
expect(configs.length).toBe(2); | ||
assert(configs[0].rules !== undefined); | ||
expect('no-debugger' in configs[0].rules).toBe(true); | ||
console.log(configs[1].rules); | ||
assert(configs[1].rules !== undefined); | ||
expect('no-debugger' in configs[1].rules).toBe(false); | ||
}); | ||
}); | ||
}); | ||
@@ -219,0 +293,0 @@ |
@@ -20,2 +20,3 @@ import fs from 'node:fs'; | ||
} from './ignore-patterns.js'; | ||
import { handleOverridesScope, readOverridesFromConfig } from './overrides.js'; | ||
@@ -70,2 +71,3 @@ // default plugins, see <https://oxc.rs/docs/guide/usage/linter/config#plugins> | ||
const plugins = readPluginsFromConfig(config) ?? defaultPlugins; | ||
const categories = readCategoriesFromConfig(config) ?? defaultCategories; | ||
@@ -81,7 +83,3 @@ // it is not a plugin but it is activated by default | ||
handleCategoriesScope( | ||
plugins, | ||
readCategoriesFromConfig(config) ?? defaultCategories, | ||
rules | ||
); | ||
handleCategoriesScope(plugins, categories, rules); | ||
@@ -105,3 +103,10 @@ const configRules = readRulesFromConfig(config); | ||
return [baseConfig]; | ||
const overrides = readOverridesFromConfig(config); | ||
const configs = [baseConfig]; | ||
if (overrides !== undefined) { | ||
handleOverridesScope(overrides, configs, categories); | ||
} | ||
return configs; | ||
}; | ||
@@ -108,0 +113,0 @@ |
@@ -1,2 +0,6 @@ | ||
import { OxlintConfig, OxlintConfigPlugins } from './types.js'; | ||
import { | ||
OxlintConfig, | ||
OxlintConfigOverride, | ||
OxlintConfigPlugins, | ||
} from './types.js'; | ||
@@ -8,3 +12,3 @@ /** | ||
export const readPluginsFromConfig = ( | ||
config: OxlintConfig | ||
config: OxlintConfig | OxlintConfigOverride | ||
): OxlintConfigPlugins | undefined => { | ||
@@ -11,0 +15,0 @@ return 'plugins' in config && Array.isArray(config.plugins) |
@@ -5,3 +5,7 @@ import { | ||
} from '../constants.js'; | ||
import { OxlintConfig, OxlintConfigRules } from './types.js'; | ||
import { | ||
OxlintConfig, | ||
OxlintConfigOverride, | ||
OxlintConfigRules, | ||
} from './types.js'; | ||
import configByCategory from '../generated/configs-by-category.js'; | ||
@@ -104,3 +108,3 @@ import { isObject } from './utils.js'; | ||
export const readRulesFromConfig = ( | ||
config: OxlintConfig | ||
config: OxlintConfig | OxlintConfigOverride | ||
): OxlintConfigRules | undefined => { | ||
@@ -107,0 +111,0 @@ return 'rules' in config && isObject(config.rules) |
@@ -13,2 +13,8 @@ import type { Linter } from 'eslint'; | ||
export type OxlintConfigOverride = { | ||
files: string[]; | ||
plugins?: OxlintConfigPlugins; | ||
rules?: OxlintConfigRules; | ||
}; | ||
export type OxlintConfig = { | ||
@@ -15,0 +21,0 @@ [key: string]: unknown; |
@@ -14,2 +14,3 @@ // These rules are automatically generated by scripts/generate-rules.ts | ||
'no-inner-declarations': 'off', | ||
'no-negated-condition': 'off', | ||
'no-new-wrappers': 'off', | ||
@@ -52,3 +53,2 @@ 'no-object-constructor': 'off', | ||
'unicorn/no-lonely-if': 'off', | ||
'unicorn/no-negated-condition': 'off', | ||
'unicorn/no-negation-in-equality-check': 'off', | ||
@@ -156,7 +156,10 @@ 'unicorn/no-new-buffer': 'off', | ||
'no-duplicate-imports': 'off', | ||
'no-extra-label': 'off', | ||
'no-label-var': 'off', | ||
'no-labels': 'off', | ||
'no-magic-numbers': 'off', | ||
'no-multi-assign': 'off', | ||
'no-multi-str': 'off', | ||
'no-nested-ternary': 'off', | ||
'no-new-func': 'off', | ||
'no-restricted-imports': 'off', | ||
'no-return-assign': 'off', | ||
@@ -169,7 +172,10 @@ 'no-script-url': 'off', | ||
'prefer-object-has-own': 'off', | ||
'prefer-rest-params': 'off', | ||
'prefer-spread': 'off', | ||
'sort-imports': 'off', | ||
'sort-keys': 'off', | ||
'vars-on-top': 'off', | ||
yoda: 'off', | ||
'import/first': 'off', | ||
'import/no-named-default': 'off', | ||
'import/no-namespace': 'off', | ||
@@ -233,3 +239,2 @@ 'jest/consistent-test-it': 'off', | ||
'@typescript-eslint/no-magic-numbers': 'off', | ||
'@typescript-eslint/no-restricted-imports': 'off', | ||
'@typescript-eslint/prefer-for-of': 'off', | ||
@@ -328,3 +333,2 @@ '@typescript-eslint/prefer-function-type': 'off', | ||
'import/default': 'off', | ||
'import/named': 'off', | ||
'import/namespace': 'off', | ||
@@ -371,2 +375,3 @@ 'jest/expect-expect': 'off', | ||
'jsx-a11y/no-distracting-elements': 'off', | ||
'jsx-a11y/no-noninteractive-tabindex': 'off', | ||
'jsx-a11y/no-redundant-roles': 'off', | ||
@@ -373,0 +378,0 @@ 'jsx-a11y/prefer-tag-over-role': 'off', |
@@ -51,2 +51,3 @@ // These rules are automatically generated by scripts/generate-rules.ts | ||
'no-extra-boolean-cast': 'off', | ||
'no-extra-label': 'off', | ||
'no-fallthrough': 'off', | ||
@@ -61,5 +62,9 @@ 'no-func-assign': 'off', | ||
'no-label-var': 'off', | ||
'no-labels': 'off', | ||
'no-loss-of-precision': 'off', | ||
'no-magic-numbers': 'off', | ||
'no-multi-assign': 'off', | ||
'no-multi-str': 'off', | ||
'no-negated-condition': 'off', | ||
'no-nested-ternary': 'off', | ||
'no-new': 'off', | ||
@@ -78,3 +83,2 @@ 'no-new-func': 'off', | ||
'no-restricted-globals': 'off', | ||
'no-restricted-imports': 'off', | ||
'no-return-assign': 'off', | ||
@@ -111,2 +115,3 @@ 'no-script-url': 'off', | ||
'prefer-object-has-own': 'off', | ||
'prefer-rest-params': 'off', | ||
'prefer-spread': 'off', | ||
@@ -123,2 +128,3 @@ radix: 'off', | ||
'valid-typeof': 'off', | ||
'vars-on-top': 'off', | ||
yoda: 'off', | ||
@@ -131,3 +137,2 @@ } as const; | ||
'import/max-dependencies': 'off', | ||
'import/named': 'off', | ||
'import/namespace': 'off', | ||
@@ -142,2 +147,3 @@ 'import/no-amd': 'off', | ||
'import/no-named-as-default-member': 'off', | ||
'import/no-named-default': 'off', | ||
'import/no-namespace': 'off', | ||
@@ -244,2 +250,3 @@ 'import/no-self-import': 'off', | ||
'jsx-a11y/no-distracting-elements': 'off', | ||
'jsx-a11y/no-noninteractive-tabindex': 'off', | ||
'jsx-a11y/no-redundant-roles': 'off', | ||
@@ -372,3 +379,2 @@ 'jsx-a11y/prefer-tag-over-role': 'off', | ||
'@typescript-eslint/no-require-imports': 'off', | ||
'@typescript-eslint/no-restricted-imports': 'off', | ||
'@typescript-eslint/no-this-alias': 'off', | ||
@@ -420,3 +426,2 @@ '@typescript-eslint/no-unnecessary-type-constraint': 'off', | ||
'unicorn/no-magic-array-flat-depth': 'off', | ||
'unicorn/no-negated-condition': 'off', | ||
'unicorn/no-negation-in-equality-check': 'off', | ||
@@ -423,0 +428,0 @@ 'unicorn/no-nested-ternary': 'off', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
574377
65
11537