Skip to content

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

Merged
merged 2 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .eslintignore

This file was deleted.

58 changes: 0 additions & 58 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
VALIDATE_JAVASCRIPT_ES: false
VALIDATE_JAVASCRIPT_PRETTIER: false
VALIDATE_JAVASCRIPT_STANDARD: false
VALIDATE_JSON: false
VALIDATE_JSON_PRETTIER: false
VALIDATE_JSCPD: false
VALIDATE_NATURAL_LANGUAGE: false
Expand Down
2 changes: 1 addition & 1 deletion dist/cli/formatters/markdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

201 changes: 201 additions & 0 deletions eslint.config.js
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',

// 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This configuration disables several powerful type-aware linting rules from @typescript-eslint (e.g., no-unsafe-assignment, no-unsafe-call, restrict-template-expressions). While this might be an intentional choice for the project, turning these rules off can reduce the ability to catch potential runtime type errors during development.

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 project: './tsconfig.json', which enables these type-aware checks.

},
},

// 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/**',
],
},
]
Loading