@newhighsco/eslint-config 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/eslint.config.js +13 -29
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm install --save-dev eslint @newhighsco/eslint-config
|
|
|
12
12
|
|
|
13
13
|
### Prettier
|
|
14
14
|
|
|
15
|
-
`@newhighsco/eslint-config` should be used in conjunction with [Prettier](https://prettier.io/). See the [`@newhighsco/prettier-config` installation guide](
|
|
15
|
+
`@newhighsco/eslint-config` should be used in conjunction with [Prettier](https://prettier.io/). See the [`@newhighsco/prettier-config` installation guide](../prettier-config#installation) for more details.
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
New High Score ESLint rules come bundled in `@newhighsco/eslint-config`. To enable these rules, add an `eslint.config.js` at the root of your project. See the [ESLint configuration docs](https://eslint.org/docs/user-guide/configuring) for more details.
|
package/eslint.config.js
CHANGED
|
@@ -7,16 +7,16 @@ import { defineConfig } from 'eslint/config'
|
|
|
7
7
|
|
|
8
8
|
const gitignore = join(process.cwd(), '.gitignore')
|
|
9
9
|
const compat = new FlatCompat()
|
|
10
|
+
const ignore = existsSync(gitignore)
|
|
11
|
+
const typescript = await import('typescript')
|
|
12
|
+
.then(() => true)
|
|
13
|
+
.catch(() => false)
|
|
10
14
|
|
|
11
15
|
export default defineConfig(
|
|
12
16
|
[
|
|
13
17
|
...compat.config({
|
|
14
|
-
parserOptions: {
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
env: {
|
|
18
|
-
jest: true
|
|
19
|
-
},
|
|
18
|
+
parserOptions: { requireConfigFile: false },
|
|
19
|
+
env: { jest: true },
|
|
20
20
|
extends: ['standard', 'plugin:prettier/recommended'],
|
|
21
21
|
ignorePatterns: ['!.github', '!.storybook'],
|
|
22
22
|
plugins: ['simple-import-sort'],
|
|
@@ -34,7 +34,7 @@ export default defineConfig(
|
|
|
34
34
|
]
|
|
35
35
|
},
|
|
36
36
|
// Typescript
|
|
37
|
-
{
|
|
37
|
+
typescript && {
|
|
38
38
|
files: ['*.ts?(x)'],
|
|
39
39
|
extends: ['love', 'plugin:prettier/recommended'],
|
|
40
40
|
parserOptions: {
|
|
@@ -43,18 +43,10 @@ export default defineConfig(
|
|
|
43
43
|
},
|
|
44
44
|
plugins: ['tsc'],
|
|
45
45
|
rules: {
|
|
46
|
-
'tsc/config': [
|
|
47
|
-
'error',
|
|
48
|
-
{
|
|
49
|
-
configFile: './tsconfig.json'
|
|
50
|
-
}
|
|
51
|
-
],
|
|
46
|
+
'tsc/config': ['error', { configFile: './tsconfig.json' }],
|
|
52
47
|
'@typescript-eslint/consistent-type-assertions': [
|
|
53
48
|
'error',
|
|
54
|
-
{
|
|
55
|
-
assertionStyle: 'as',
|
|
56
|
-
objectLiteralTypeAssertions: 'allow'
|
|
57
|
-
}
|
|
49
|
+
{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }
|
|
58
50
|
],
|
|
59
51
|
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
60
52
|
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
@@ -64,9 +56,7 @@ export default defineConfig(
|
|
|
64
56
|
// React
|
|
65
57
|
{
|
|
66
58
|
files: ['*.{js,ts,md}x'],
|
|
67
|
-
env: {
|
|
68
|
-
browser: true
|
|
69
|
-
},
|
|
59
|
+
env: { browser: true },
|
|
70
60
|
extends: [
|
|
71
61
|
'standard-react',
|
|
72
62
|
'standard-jsx',
|
|
@@ -86,9 +76,7 @@ export default defineConfig(
|
|
|
86
76
|
'plugin:storybook/recommended',
|
|
87
77
|
'plugin:storybook/csf-strict'
|
|
88
78
|
],
|
|
89
|
-
rules: {
|
|
90
|
-
'storybook/meta-inline-properties': 'error'
|
|
91
|
-
}
|
|
79
|
+
rules: { 'storybook/meta-inline-properties': 'error' }
|
|
92
80
|
},
|
|
93
81
|
// Testing Library
|
|
94
82
|
{
|
|
@@ -102,13 +90,9 @@ export default defineConfig(
|
|
|
102
90
|
}
|
|
103
91
|
},
|
|
104
92
|
// Cypress
|
|
105
|
-
{
|
|
106
|
-
files: ['*.cy.*'],
|
|
107
|
-
extends: ['plugin:cypress/recommended']
|
|
108
|
-
}
|
|
93
|
+
{ files: ['*.cy.*'], extends: ['plugin:cypress/recommended'] }
|
|
109
94
|
]
|
|
110
95
|
}),
|
|
111
|
-
|
|
112
|
-
includeIgnoreFile(gitignore, 'Imported .gitignore patterns')
|
|
96
|
+
ignore && includeIgnoreFile(gitignore)
|
|
113
97
|
].filter(Boolean)
|
|
114
98
|
)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newhighsco/eslint-config",
|
|
3
3
|
"description": "New High Score shareable config for ESLint",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.1",
|
|
5
5
|
"author": "New High Score",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"private": false,
|
|
@@ -52,6 +52,12 @@
|
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"eslint": "9.38.0",
|
|
55
|
-
"prettier": "3.6.2"
|
|
55
|
+
"prettier": "3.6.2",
|
|
56
|
+
"typescript": "5.9.3"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"typescript": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
}
|