Skip to content

Commit

Permalink
🧵 Migrate to v9 ESLint and new flat config system
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-uk committed Dec 6, 2024
1 parent 7df57fc commit f5970f2
Show file tree
Hide file tree
Showing 5 changed files with 316 additions and 286 deletions.
51 changes: 51 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import globals from 'globals'

export default [
// Apply recommended rules for JavaScript and TypeScript
js.configs.recommended,
...tseslint.configs.recommended,

// Customize rules & options
{
languageOptions: {
globals: {
// Add browser globals like `window`, `document`, etc.
...globals.browser,
},
},

rules: {
'no-var': 'error',
'prefer-const': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
// Allows for Go style _var ignoring
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'no-undef': 'error',
'no-duplicate-imports': 'error',
'no-constructor-return': 'error',
'no-promise-executor-return': 'error',
'prefer-template': 'error',
'dot-notation': 'error',

'func-style': [
'error',
'declaration',
{
allowArrowFunctions: true,
},
],

'object-shorthand': 'error',
'spaced-comment': 'error',
},
},
]
Loading

0 comments on commit f5970f2

Please sign in to comment.