Skip to content

Commit

Permalink
feat: migrate to flat config 🚀
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The ruleset has been migrated to ESLint flat config format and is therefore not compatible with ESLint v7 and using it with v8 requires a feature flag (`ESLINT_USE_FLAT_CONFIG=true`). Project configuration will also need to be completely reworked to use the new ruleset.
  • Loading branch information
robertrossmann committed Feb 14, 2024
1 parent e044364 commit 7b386f6
Show file tree
Hide file tree
Showing 37 changed files with 2,184 additions and 7,109 deletions.
File renamed without changes.
22 changes: 0 additions & 22 deletions .eslintrc.js

This file was deleted.

3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"**/.git": true,
"**/.DS_Store": true,
"**/*.log": true,
"**/node_modules": true,
".eslintcache": true
},
// Custom Application window title ❤️
Expand All @@ -19,10 +18,10 @@
"javascript.format.enable": false,
"typescript.format.enable": false,
// Enable ESLint and its auto-fixer
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"eslint.lintTask.enable": true,
"eslint.lintTask.options": ".",
"eslint.experimental.useFlatConfig": true,
}
26 changes: 26 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import node from './packages/eslint-config-node/index.mjs'
import optional from './packages/eslint-config-node/optional.mjs'
import style from './packages/eslint-config-node/style.mjs'

/** @type {import("eslint").Linter.FlatConfig} */
const common = {
linterOptions: {
reportUnusedDisableDirectives: true,
},
ignores: [
'node_modules',
'!.*.js',
],
}

/** @type {Array<import("eslint").Linter.FlatConfig>} */
const configs = [
common,
node,
optional,
style,
{ files: ['**/*.js'], languageOptions: { sourceType: 'commonjs' } },
{ files: ['**/*.mjs', 'eslint.config.js'], languageOptions: { sourceType: 'module' } },
]

export default configs
2 changes: 2 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
SHELL := sh
export PATH := bin/:node_modules/.bin/:$(PATH)
export NODE_OPTIONS := --trace-deprecation
# Enable ESLint Flat Config support
export ESLINT_USE_FLAT_CONFIG=true

# On CI servers, use the `npm ci` installer to avoid introducing changes to the package-lock.json
# On developer machines, prefer the generally more flexible `npm install`. 💪
Expand Down
Loading

0 comments on commit 7b386f6

Please sign in to comment.