linter: bug in eslint disable comment
@Boshen it is does not work. Example command is here
❯ time bunx oxlint --config ./packages/eslint-config-node/oxlintrc.json
× eslint(max-lines): File has too many lines (385).
╭─[packages/eslint-config-base/airbnb-rules.cjs:1:1]
1 │ // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
· ▲
2 │ /* eslint-disable max-lines */
╰────
help: Maximum allowed is 160.
Finished in 6ms on 36 files with 96 rules using 8 threads.
Found 0 warnings and 1 error.
________________________________________________________
Executed in 100.39 millis fish external
usr time 70.47 millis 78.00 micros 70.39 millis
sys time 22.72 millis 353.00 micros 22.37 millis
airlight on master via ⬢ v22.4.0
❯
Originally posted by @dalisoft in https://github.com/oxc-project/oxc/issues/2999#issuecomment-2212543950
eslint-disable max-lines should be on the first line.
The compatibility with eslint will be losed. I hope it will be implemented in future
I can no longer reproduce this. What's the input and the expected outcome?
Close as can't repro.
I can no longer reproduce this. What's the input and the expected outcome?
Close as can't repro.
@Boshen issue still persists
oxlintrc.json
{
"env": {
"es2015": true,
"es2020": true,
"node": true,
"browser": false,
"jest": true
},
"globals": {},
"rules": {
"brace-style": "off",
"@stylistic/brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"camelcase": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": [
"function",
"method"
],
"format": [
"strictCamelCase"
],
"leadingUnderscore": "forbid"
},
{
"selector": "property",
"format": [
"snake_case",
"strictCamelCase"
],
"leadingUnderscore": "forbid"
},
{
"selector": "objectLiteralProperty",
"format": [],
"leadingUnderscore": "forbid"
},
{
"selector": "variable",
"modifiers": [
"const"
],
"types": [
"boolean",
"number"
],
"format": [
"UPPER_CASE"
],
"leadingUnderscore": "forbid"
},
{
"selector": "typeLike",
"format": [
"StrictPascalCase"
],
"leadingUnderscore": "forbid"
},
{
"selector": "interface",
"format": [
"PascalCase"
],
"leadingUnderscore": "forbid",
"custom": {
"regex": "^I[A-Z]",
"match": true
}
}
],
"comma-dangle": "off",
"@stylistic/comma-dangle": [
"error",
"never"
],
"comma-spacing": "off",
"@stylistic/comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"default-param-last": "off",
"@typescript-eslint/default-param-last": "error",
"dot-notation": "off",
"@typescript-eslint/dot-notation": "error",
"func-call-spacing": "off",
"@stylistic/function-call-spacing": [
"error",
"never"
],
"indent": [
"error",
2,
{
"SwitchCase": 1,
"flatTernaryExpressions": false,
"offsetTernaryExpressions": true
}
],
"@typescript-eslint/indent": [
"off"
],
"keyword-spacing": "off",
"@stylistic/keyword-spacing": [
"error",
{
"before": true,
"after": true,
"overrides": {
"return": {
"after": true
},
"throw": {
"after": true
},
"case": {
"after": true
}
}
}
],
"lines-between-class-members": "off",
"@stylistic/lines-between-class-members": [
"error",
"always",
{
"exceptAfterSingleLine": false
}
],
"no-array-constructor": "off",
"@typescript-eslint/no-array-constructor": "error",
"no-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": "error",
"no-empty-function": [
"error"
],
"@typescript-eslint/no-empty-function": "off",
"no-extra-parens": "off",
"@typescript-eslint/no-extra-parens": [
"off",
"all",
{
"conditionalAssign": true,
"nestedBinaryExpressions": false,
"returnAssign": false,
"ignoreJSX": "all",
"enforceForArrowConditionals": false
}
],
"no-extra-semi": "off",
"@stylistic/no-extra-semi": "error",
"no-implied-eval": "off",
"no-new-func": "off",
"@typescript-eslint/no-implied-eval": "error",
"no-loss-of-precision": "off",
"@typescript-eslint/no-loss-of-precision": "error",
"no-loop-func": "off",
"@typescript-eslint/no-loop-func": "error",
"no-magic-numbers": "off",
"@typescript-eslint/no-magic-numbers": [
"off",
{
"ignore": [],
"ignoreArrayIndexes": true,
"enforceConst": true,
"detectObjects": false
}
],
"no-redeclare": "off",
"@typescript-eslint/no-redeclare": "error",
"no-shadow": [
"error",
{
"hoist": "functions"
}
],
"@typescript-eslint/no-shadow": "off",
"space-before-blocks": "off",
"@stylistic/space-before-blocks": "error",
"no-throw-literal": "off",
"@typescript-eslint/only-throw-error": "error",
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": [
"error",
{
"allowShortCircuit": false,
"allowTernary": false,
"allowTaggedTemplates": false
}
],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"vars": "all",
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": false
}
],
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": [
"error",
{
"functions": true,
"classes": true,
"variables": true
}
],
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "error",
"quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"@stylistic/quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"semi": "off",
"@stylistic/semi": [
"error",
"always"
],
"space-before-function-paren": "off",
"@stylistic/space-before-function-paren": [
"error",
{
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
],
"require-await": "off",
"@typescript-eslint/require-await": "off",
"no-return-await": "off",
"@typescript-eslint/return-await": [
"error",
"in-try-catch"
],
"space-infix-ops": "off",
"@stylistic/space-infix-ops": "error",
"object-curly-spacing": "off",
"@stylistic/object-curly-spacing": [
"error",
"always"
],
"@typescript-eslint/ban-ts-comment": "error",
"import-x/extensions": [
"error",
"ignorePackages",
{
"js": "always",
"cjs": "never",
"mjs": "always",
"jsx": "never",
"ts": "never",
"tsx": "never",
"json": "always",
"node": "always",
"wasm": "always"
}
],
"import-x/no-extraneous-dependencies": [
"error",
{
"optionalDependencies": false,
"devDependencies": [
"test/**",
"tests/**",
"spec/**",
"**/__tests__/**",
"**/__mocks__/**",
"test.{js,jsx}",
"test.{ts,tsx}",
"test-*.{js,jsx}",
"test-*.{ts,tsx}",
"**/*{.,_}{test,spec}.{js,jsx}",
"**/*{.,_}{test,spec}.{ts,tsx}",
"**/jest.config.js",
"**/jest.config.ts",
"**/jest.setup.js",
"**/jest.setup.ts",
"**/vue.config.js",
"**/vue.config.ts",
"**/webpack.config.js",
"**/webpack.config.ts",
"**/webpack.config.*.js",
"**/webpack.config.*.ts",
"**/rollup.config.js",
"**/rollup.config.ts",
"**/rollup.config.*.js",
"**/rollup.config.*.ts",
"**/gulpfile.js",
"**/gulpfile.ts",
"**/gulpfile.*.js",
"**/gulpfile.*.ts",
"**/Gruntfile{,.js}",
"**/Gruntfile{,.ts}",
"**/protractor.conf.js",
"**/protractor.conf.ts",
"**/protractor.conf.*.js",
"**/protractor.conf.*.ts",
"**/karma.conf.js",
"**/karma.conf.ts",
"**/.eslintrc.js",
"**/.eslintrc.ts",
"**/eslint.config.js",
"**/eslint.config.ts",
"**/eslint.config.cjs",
"**/eslint.config.mjs"
]
}
],
"@eslint-community/eslint-comments/no-unused-disable": "error",
"@eslint-community/eslint-comments/disable-enable-pair": "warn",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/class-literal-property-style": [
"error"
],
"@typescript-eslint/no-non-null-asserted-optional-chain": [
"error"
],
"@typescript-eslint/restrict-plus-operands": [
"error"
],
"operator-linebreak": [
"off",
"after"
],
"prefer-template": "error",
"complexity": [
"error",
{
"max": 7
}
],
"max-depth": [
"error",
{
"max": 3
}
],
"max-nested-callbacks": [
"error",
{
"max": 3
}
],
"max-lines-per-function": [
"error",
{
"max": 60,
"skipBlankLines": true,
"skipComments": true,
"IIFEs": true
}
],
"max-lines": [
"error",
{
"max": 160,
"skipBlankLines": true,
"skipComments": true
}
],
"no-useless-concat": "error",
"no-console": "warn",
"no-template-curly-in-string": "error",
"no-underscore-dangle": "off",
"import-x/prefer-default-export": "warn",
"import-x/no-mutable-exports": "error",
"n/no-unsupported-features/es-syntax": [
"error",
{
"ignores": [
"modules"
]
}
]
},
"settings": {
"node": {
"tryExtensions": [
".ts",
".js",
".d.ts",
".html",
".md",
".json",
".wasm",
".node"
]
},
"import-x/resolver": {
"node": {
"extensions": [
".ts",
".mjs",
".js",
".d.ts",
".html",
".md",
".json",
".wasm",
".node"
]
},
"typescript": {
"alwaysTryTypes": true,
"project": [
"packages/*/tsconfig.json",
"tsconfig.json"
]
}
},
"import-x/extensions": [
".ts",
".mjs",
".js",
".d.ts",
".html",
".md",
".json",
".wasm",
".node"
],
"import-x/external-module-folders": [
"node_modules",
"node_modules/@types"
],
"import-x/parsers": {
"@typescript-eslint/parser": [
".ts",
".tsx",
".d.ts"
]
}
}
}
Originally posted by @dalisoft in https://github.com/oxc-project/oxc/issues/2999#issuecomment-2287376095
Made another attempt in https://github.com/oxc-project/oxc/pull/5117
Yes, it is now works
Thank you for fix @Boshen
Thank you for fix @Boshen
You're welcome.