Skip to content

Commit

Permalink
chore: update eslint and use flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Nov 29, 2024
1 parent 6fa7141 commit b7140f9
Show file tree
Hide file tree
Showing 4 changed files with 404 additions and 435 deletions.
55 changes: 0 additions & 55 deletions .eslintrc.cjs

This file was deleted.

64 changes: 64 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// @ts-check

import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import vitest from '@vitest/eslint-plugin'
import eslintConfigPrettier from 'eslint-config-prettier'
import globals from 'globals'

export default tseslint.config(
{
languageOptions: {
sourceType: 'module'
},
linterOptions: {
reportUnusedDisableDirectives: 'error'
}
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
{
files: ['**/*.{js,mjs}'],
rules: {
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }]
}
},
{
rules: {
'no-empty': ['error', { allowEmptyCatch: true }],
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }]
}
},
{
files: [
'examples/**/*.{js,mjs}',
'tests/examples-overrides/**/*.{js,mjs}',
'tests/fixtures/**/*.{js,mjs}'
],
languageOptions: {
globals: globals.browser
}
},
{
files: [
'examples/**/backend-src/**/*.{js,mjs}',
'examples/**/server.{js,mjs}'
],
languageOptions: {
globals: globals.node
}
},
{
files: ['tests/**/*.{js,ts}'],
...vitest.configs.recommended
},
eslintConfigPrettier,
{
ignores: ['dist/**', '.examples-temp/**', 'tests/.fixtures-temp/**']
}
)
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
},
"packageManager": "[email protected]",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-vitest": "^0.3.9",
"@vitest/eslint-plugin": "^1.1.12",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.12.0",
"prettier": "^3.1.0",
"typescript": "^5.2.2"
"typescript": "^5.2.2",
"typescript-eslint": "^8.16.0"
}
}
Loading

0 comments on commit b7140f9

Please sign in to comment.