-
-
Notifications
You must be signed in to change notification settings - Fork 402
chore: Update to ESLint 9 #1654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
const js = require('@eslint/js') | ||
const typescript = require('@typescript-eslint/eslint-plugin') | ||
const typescriptParser = require('@typescript-eslint/parser') | ||
const prettier = require('eslint-plugin-prettier') | ||
const prettierConfig = require('eslint-config-prettier') | ||
|
||
module.exports = [ | ||
// Base recommended config for JavaScript files | ||
js.configs.recommended, | ||
|
||
// JavaScript files | ||
{ | ||
files: ['**/*.js', '**/*.mjs'], | ||
languageOptions: { | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
globals: { | ||
process: 'readonly', | ||
Buffer: 'readonly', | ||
__dirname: 'readonly', | ||
__filename: 'readonly', | ||
module: 'readonly', | ||
require: 'readonly', | ||
exports: 'readonly', | ||
global: 'readonly', | ||
console: 'readonly', | ||
setImmediate: 'readonly', | ||
}, | ||
}, | ||
plugins: { | ||
prettier, | ||
}, | ||
rules: { | ||
'prettier/prettier': 'error', | ||
}, | ||
}, | ||
|
||
// TypeScript files | ||
{ | ||
files: ['**/*.ts'], | ||
languageOptions: { | ||
parser: typescriptParser, | ||
parserOptions: { | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
project: './tsconfig.json', | ||
warnOnUnsupportedTypeScriptVersion: false, | ||
}, | ||
globals: { | ||
process: 'readonly', | ||
Buffer: 'readonly', | ||
__dirname: 'readonly', | ||
__filename: 'readonly', | ||
module: 'readonly', | ||
require: 'readonly', | ||
exports: 'readonly', | ||
global: 'readonly', | ||
console: 'readonly', | ||
setImmediate: 'readonly', | ||
}, | ||
}, | ||
plugins: { | ||
'@typescript-eslint': typescript, | ||
prettier, | ||
}, | ||
rules: { | ||
// Base JavaScript rules we want to keep | ||
'constructor-super': 'error', | ||
'for-direction': 'error', | ||
'getter-return': 'error', | ||
'no-async-promise-executor': 'error', | ||
'no-case-declarations': 'error', | ||
'no-class-assign': 'error', | ||
'no-compare-neg-zero': 'error', | ||
'no-cond-assign': 'error', | ||
'no-const-assign': 'error', | ||
'no-constant-condition': 'error', | ||
'no-control-regex': 'error', | ||
'no-debugger': 'error', | ||
'no-delete-var': 'error', | ||
'no-dupe-args': 'error', | ||
'no-dupe-class-members': 'error', | ||
'no-dupe-else-if': 'error', | ||
'no-dupe-keys': 'error', | ||
'no-duplicate-case': 'error', | ||
'no-empty': 'error', | ||
'no-empty-character-class': 'error', | ||
'no-empty-pattern': 'error', | ||
'no-ex-assign': 'error', | ||
'no-extra-boolean-cast': 'error', | ||
'no-extra-semi': 'error', | ||
'no-fallthrough': 'error', | ||
'no-func-assign': 'error', | ||
'no-global-assign': 'error', | ||
'no-import-assign': 'error', | ||
'no-inner-declarations': 'error', | ||
'no-invalid-regexp': 'error', | ||
'no-irregular-whitespace': 'error', | ||
'no-misleading-character-class': 'error', | ||
'no-mixed-spaces-and-tabs': 'error', | ||
'no-new-symbol': 'error', | ||
'no-nonoctal-decimal-escape': 'error', | ||
'no-obj-calls': 'error', | ||
'no-octal': 'error', | ||
'no-prototype-builtins': 'error', | ||
'no-redeclare': 'error', | ||
'no-regex-spaces': 'error', | ||
'no-self-assign': 'error', | ||
'no-setter-return': 'error', | ||
'no-shadow-restricted-names': 'error', | ||
'no-sparse-arrays': 'error', | ||
'no-this-before-super': 'error', | ||
'no-unexpected-multiline': 'error', | ||
'no-unreachable': 'error', | ||
'no-unsafe-finally': 'error', | ||
'no-unsafe-negation': 'error', | ||
'no-useless-catch': 'error', | ||
'no-useless-escape': 'off', | ||
'no-with': 'error', | ||
'require-yield': 'error', | ||
'use-isnan': 'error', | ||
'valid-typeof': 'error', | ||
coliff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Disable rules that TypeScript handles better | ||
'no-unused-vars': 'off', | ||
'no-undef': 'off', | ||
|
||
// TypeScript-specific rules | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
caughtErrorsIgnorePattern: '^_|^e$|^error$', | ||
destructuredArrayIgnorePattern: '^_', | ||
ignoreRestSiblings: true, | ||
}, | ||
], | ||
'@typescript-eslint/no-explicit-any': 'warn', | ||
|
||
'prettier/prettier': 'error', | ||
|
||
// Custom rules from original config | ||
'arrow-body-style': ['error'], | ||
'no-template-curly-in-string': 'error', | ||
'no-useless-concat': 'error', | ||
'no-var': 'error', | ||
'one-var': ['error', 'never'], | ||
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }], | ||
'prefer-const': 'error', | ||
'prefer-template': 'error', | ||
'template-curly-spacing': 'error', | ||
'template-tag-spacing': 'error', | ||
quotes: ['error', 'single', { avoidEscape: true }], | ||
|
||
// TypeScript-specific rule overrides from original config | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/no-unsafe-argument': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/no-unsafe-call': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/no-require-imports': 'off', | ||
'@typescript-eslint/restrict-template-expressions': 'off', | ||
Comment on lines
+157
to
+165
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This configuration disables several powerful type-aware linting rules from It's recommended to evaluate if some of these rules could be enabled, perhaps at a 'warn' level initially, to enhance type safety and code correctness. This is particularly important as the project uses |
||
}, | ||
}, | ||
|
||
// Jest test files | ||
{ | ||
files: ['**/*.spec.js'], | ||
languageOptions: { | ||
globals: { | ||
describe: 'readonly', | ||
it: 'readonly', | ||
test: 'readonly', | ||
expect: 'readonly', | ||
beforeEach: 'readonly', | ||
afterEach: 'readonly', | ||
beforeAll: 'readonly', | ||
afterAll: 'readonly', | ||
jest: 'readonly', | ||
}, | ||
}, | ||
}, | ||
|
||
// Prettier config | ||
prettierConfig, | ||
|
||
// Ignore patterns (replacing .eslintignore) | ||
{ | ||
ignores: [ | ||
'node_modules/**', | ||
'bin/**', | ||
'dist/**', | ||
'website/.astro/**', | ||
'website/build/**', | ||
'website/src/**', | ||
coliff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
], | ||
}, | ||
] |
Uh oh!
There was an error while loading. Please reload this page.