Skip to content

Commit 687b37e

Browse files
committed
chore: switch to eslint flat config and run prettier separately
1 parent ec367c1 commit 687b37e

File tree

6 files changed

+85
-60
lines changed

6 files changed

+85
-60
lines changed

.eslintignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 40 deletions
This file was deleted.

.prettierignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ package.json
55
**/es
66
**/build
77
**/coverage
8-
node_modules
9-
*.md

.prettierrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66
"arrowParens": "always",
77
"overrides": [
8-
{
9-
"files": "packages/node_modules/**/*"
10-
},
118
{
129
"files": "*.md",
1310
"options": {

eslint.config.mjs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// @ts-check
2+
3+
import globals from 'globals'
4+
import tseslint from 'typescript-eslint'
5+
import js from '@eslint/js'
6+
import eslintConfigPrettier from 'eslint-config-prettier/flat'
7+
8+
export default tseslint.config(
9+
{
10+
ignores: [
11+
'packages/*/**/lib/',
12+
'packages/*/**/es/',
13+
'packages/*/**/dist/',
14+
'**/build/',
15+
'**/*.min.js',
16+
'**/bundle.js',
17+
'**/coverage/',
18+
'**/vendor/',
19+
],
20+
},
21+
js.configs.recommended,
22+
{
23+
plugins: {
24+
'@typescript-eslint': tseslint.plugin,
25+
},
26+
languageOptions: {
27+
globals: {
28+
...globals.browser,
29+
...globals.node,
30+
...globals.mocha,
31+
},
32+
ecmaVersion: 2022,
33+
sourceType: 'module',
34+
parser: tseslint.parser,
35+
parserOptions: {
36+
ecmaVersion: 2022,
37+
projectService: true,
38+
projectFolderIgnoreList: [
39+
'!packages/node_modules/**',
40+
'packages/*/**/node_modules/**',
41+
],
42+
},
43+
},
44+
linterOptions: {
45+
reportUnusedDisableDirectives: 'error',
46+
},
47+
rules: {
48+
'linebreak-style': ['error', 'unix'],
49+
'@typescript-eslint/no-unused-vars': [
50+
'error',
51+
{
52+
args: 'after-used',
53+
argsIgnorePattern: '^_',
54+
caughtErrors: 'all',
55+
caughtErrorsIgnorePattern: '^_',
56+
destructuredArrayIgnorePattern: '^_',
57+
varsIgnorePattern: '^_',
58+
ignoreRestSiblings: true,
59+
},
60+
],
61+
'@typescript-eslint/no-explicit-any': 'off',
62+
'no-unused-vars': 'off',
63+
'import/export': 'off',
64+
'no-dupe-class-members': 'off',
65+
'no-empty-pattern': 'off',
66+
'no-redeclare': 'off',
67+
'no-undef': 'off',
68+
'no-unused-expressions': 'off',
69+
'no-use-before-define': 'off',
70+
'no-useless-constructor': 'off',
71+
},
72+
},
73+
eslintConfigPrettier,
74+
{
75+
// disable type-aware linting on JS files
76+
files: ['**/*.{js,cjs,mjs,jsx}'],
77+
extends: [tseslint.configs.disableTypeChecked],
78+
}
79+
)

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"commit": "git-cz",
1010
"commit-msg": "cz-customizable-ghooks",
1111
"fixdeps": "repo-cooker --fix-dependencies",
12-
"format": "npm run lint -- --fix && prettier --write \"**/*.md\" \"**/*.json\"",
12+
"format": "eslint --fix . && prettier --write .",
1313
"install": "npm run link && npm run build",
1414
"link": "repo-cooker --link",
15-
"lint": "eslint \"**/*.js\" \"**/*.ts?\"",
15+
"lint": "eslint . && prettier --check .",
1616
"lint-staged": "lint-staged",
1717
"prepare": "husky",
1818
"release": "repo-cooker --release",
@@ -97,7 +97,10 @@
9797
"webpack-merge": "6.0.1"
9898
},
9999
"lint-staged": {
100-
"*.{js,ts,tsx}": "eslint --fix",
100+
"*.{js,ts,tsx}": [
101+
"eslint --fix",
102+
"prettier --write"
103+
],
101104
"*.{md,css,json}": "prettier --write"
102105
},
103106
"config": {

0 commit comments

Comments
 (0)