Skip to content

Commit

Permalink
Upgrade ESLint to v9
Browse files Browse the repository at this point in the history
  • Loading branch information
FiloSottile committed Jan 20, 2025
1 parent c6bcd8b commit 419a057
Show file tree
Hide file tree
Showing 5 changed files with 672 additions and 645 deletions.
35 changes: 0 additions & 35 deletions .eslintrc.cjs

This file was deleted.

54 changes: 54 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import eslint from "@eslint/js"
import tseslint from "typescript-eslint"
import stylistic from "@stylistic/eslint-plugin"
import tsdoc from "eslint-plugin-tsdoc"

export default tseslint.config(
// Global ignores for generated files.
{ ignores: ["dist/", "tests/examples/age.js"] },

eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
tseslint.configs.stylisticTypeChecked,

{
languageOptions: {
parserOptions: {
projectService: {
// Allow slow "default project" for .js config files in the root.
allowDefaultProject: ["*.js"]
},
tsconfigRootDir: import.meta.dirname,
}
},
plugins: {
"@stylistic": stylistic,
"tsdoc": tsdoc
},
rules: {
"@stylistic/semi": ["error", "never"],
"@stylistic/quotes": ["error", "double", { "allowTemplateLiterals": true /*"avoidEscape"*/ }],
"@stylistic/brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"@stylistic/indent": ["error", 4],
"curly": ["error", "multi-line"],

"eqeqeq": "error",
"no-var": "error",
"prefer-const": "error",
"no-constant-binary-expression": "error",
"no-self-compare": "error",

"tsdoc/syntax": "error"
}
},

// tsconfig.json (used by projectService) does not include .js files by default.
// Disable typed linting for the only .js files in the project, the examples.
{
files: ["tests/examples/*.js"],
extends: [tseslint.configs.disableTypeChecked],
rules: {
"no-undef": "off",
}
},
)
Loading

0 comments on commit 419a057

Please sign in to comment.