@newhighsco/eslint-config 4.2.9 → 5.0.0
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 +8 -6
- package/eslint.config.js +114 -0
- package/package.json +9 -9
- package/index.js +0 -96
package/README.md
CHANGED
|
@@ -15,19 +15,21 @@ npm install --save-dev eslint @newhighsco/eslint-config
|
|
|
15
15
|
`@newhighsco/eslint-config` should be used in conjunction with [Prettier](https://prettier.io/). See the [`@newhighsco/prettier-config` installation guide](https://github.com/newhighsco/prettier-config#installation) for more details.
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
|
-
New High Score ESLint rules come bundled in `@newhighsco/eslint-config`. To enable these rules, add an `
|
|
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.
|
|
19
19
|
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
20
|
+
```javascript
|
|
21
|
+
// `eslint.config.js`
|
|
22
|
+
import config from '@newhighsco/eslint-config'
|
|
23
|
+
import { defineConfig } from 'eslint/config'
|
|
24
|
+
|
|
25
|
+
export default defineConfig([{ extends: [config] }])
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
Now you can run ESLint by adding the following scripts to your `package.json`. See the [ESLint CLI docs](https://eslint.org/docs/user-guide/command-line-interface) for more details.
|
|
27
29
|
|
|
28
30
|
```json
|
|
29
31
|
"scripts": {
|
|
30
|
-
"lint:js": "eslint --cache
|
|
32
|
+
"lint:js": "eslint --cache .",
|
|
31
33
|
"format:js": "yarn lint:js --fix"
|
|
32
34
|
}
|
|
33
35
|
```
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
2
|
+
import { join } from 'node:path'
|
|
3
|
+
|
|
4
|
+
import { includeIgnoreFile } from '@eslint/compat'
|
|
5
|
+
import { FlatCompat } from '@eslint/eslintrc'
|
|
6
|
+
import { defineConfig } from 'eslint/config'
|
|
7
|
+
|
|
8
|
+
const gitignore = join(process.cwd(), '.gitignore')
|
|
9
|
+
const compat = new FlatCompat()
|
|
10
|
+
|
|
11
|
+
export default defineConfig(
|
|
12
|
+
[
|
|
13
|
+
...compat.config({
|
|
14
|
+
parserOptions: {
|
|
15
|
+
requireConfigFile: false
|
|
16
|
+
},
|
|
17
|
+
env: {
|
|
18
|
+
jest: true
|
|
19
|
+
},
|
|
20
|
+
extends: ['standard', 'plugin:prettier/recommended'],
|
|
21
|
+
ignorePatterns: ['!.github', '!.storybook'],
|
|
22
|
+
plugins: ['simple-import-sort'],
|
|
23
|
+
rules: {
|
|
24
|
+
'simple-import-sort/imports': 'error',
|
|
25
|
+
'simple-import-sort/exports': 'error'
|
|
26
|
+
},
|
|
27
|
+
overrides: [
|
|
28
|
+
// JSON
|
|
29
|
+
{
|
|
30
|
+
files: ['**/*.json'],
|
|
31
|
+
extends: [
|
|
32
|
+
'plugin:json/recommended-legacy',
|
|
33
|
+
'plugin:prettier/recommended'
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
// Typescript
|
|
37
|
+
{
|
|
38
|
+
files: ['*.ts?(x)'],
|
|
39
|
+
extends: ['love', 'plugin:prettier/recommended'],
|
|
40
|
+
parserOptions: {
|
|
41
|
+
project: './tsconfig.json',
|
|
42
|
+
warnOnUnsupportedTypeScriptVersion: false
|
|
43
|
+
},
|
|
44
|
+
plugins: ['tsc'],
|
|
45
|
+
rules: {
|
|
46
|
+
'tsc/config': [
|
|
47
|
+
'error',
|
|
48
|
+
{
|
|
49
|
+
configFile: './tsconfig.json'
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
'@typescript-eslint/consistent-type-assertions': [
|
|
53
|
+
'error',
|
|
54
|
+
{
|
|
55
|
+
assertionStyle: 'as',
|
|
56
|
+
objectLiteralTypeAssertions: 'allow'
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
60
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
61
|
+
'@typescript-eslint/strict-boolean-expressions': 'off'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
// React
|
|
65
|
+
{
|
|
66
|
+
files: ['*.{js,ts,md}x'],
|
|
67
|
+
env: {
|
|
68
|
+
browser: true
|
|
69
|
+
},
|
|
70
|
+
extends: [
|
|
71
|
+
'standard-react',
|
|
72
|
+
'standard-jsx',
|
|
73
|
+
'plugin:prettier/recommended',
|
|
74
|
+
'plugin:jsx-a11y/recommended',
|
|
75
|
+
'plugin:mdx/recommended'
|
|
76
|
+
],
|
|
77
|
+
rules: {
|
|
78
|
+
// Overrides standard-react
|
|
79
|
+
'jsx-quotes': ['error', 'prefer-double']
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
// Storybook
|
|
83
|
+
{
|
|
84
|
+
files: ['*.stories.*'],
|
|
85
|
+
extends: [
|
|
86
|
+
'plugin:storybook/recommended',
|
|
87
|
+
'plugin:storybook/csf-strict'
|
|
88
|
+
],
|
|
89
|
+
rules: {
|
|
90
|
+
'storybook/meta-inline-properties': 'error'
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
// Testing Library
|
|
94
|
+
{
|
|
95
|
+
files: ['*.spec.*'],
|
|
96
|
+
extends: ['plugin:testing-library/react'],
|
|
97
|
+
rules: {
|
|
98
|
+
'testing-library/no-node-access': [
|
|
99
|
+
'error',
|
|
100
|
+
{ allowContainerFirstChild: true }
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
// Cypress
|
|
105
|
+
{
|
|
106
|
+
files: ['*.cy.*'],
|
|
107
|
+
extends: ['plugin:cypress/recommended']
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}),
|
|
111
|
+
existsSync(gitignore) &&
|
|
112
|
+
includeIgnoreFile(gitignore, 'Imported .gitignore patterns')
|
|
113
|
+
].filter(Boolean)
|
|
114
|
+
)
|
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": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"author": "New High Score",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"private": false,
|
|
@@ -14,12 +14,15 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/newhighsco/config/issues"
|
|
16
16
|
},
|
|
17
|
-
"
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "eslint.config.js",
|
|
18
19
|
"scripts": {
|
|
19
20
|
"test": "eslint --format junit --output-file ../../reports/eslint-config.xml __tests__"
|
|
20
21
|
},
|
|
21
22
|
"files": [],
|
|
22
23
|
"dependencies": {
|
|
24
|
+
"@eslint/compat": "1.4.0",
|
|
25
|
+
"@eslint/eslintrc": "3.3.1",
|
|
23
26
|
"@typescript-eslint/eslint-plugin": "7.18.0",
|
|
24
27
|
"@typescript-eslint/parser": "7.18.0",
|
|
25
28
|
"eslint-config-prettier": "10.1.8",
|
|
@@ -27,9 +30,10 @@
|
|
|
27
30
|
"eslint-config-standard-jsx": "11.0.0",
|
|
28
31
|
"eslint-config-standard-react": "13.0.0",
|
|
29
32
|
"eslint-config-love": "44.0.0",
|
|
33
|
+
"eslint-formatter-junit": "8.40.0",
|
|
30
34
|
"eslint-plugin-cypress": "3.6.0",
|
|
31
35
|
"eslint-plugin-import": "2.32.0",
|
|
32
|
-
"eslint-plugin-json
|
|
36
|
+
"eslint-plugin-json": "4.0.1",
|
|
33
37
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
34
38
|
"eslint-plugin-mdx": "3.6.2",
|
|
35
39
|
"eslint-plugin-n": "17.15.1",
|
|
@@ -44,14 +48,10 @@
|
|
|
44
48
|
},
|
|
45
49
|
"devDependencies": {
|
|
46
50
|
"@types/react": "19.2.2",
|
|
47
|
-
"eslint": "
|
|
51
|
+
"eslint": "9.38.0"
|
|
48
52
|
},
|
|
49
53
|
"peerDependencies": {
|
|
50
|
-
"eslint": "
|
|
54
|
+
"eslint": "9.38.0",
|
|
51
55
|
"prettier": "3.6.2"
|
|
52
|
-
},
|
|
53
|
-
"eslintConfig": {
|
|
54
|
-
"root": true,
|
|
55
|
-
"extends": "."
|
|
56
56
|
}
|
|
57
57
|
}
|
package/index.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parserOptions: {
|
|
3
|
-
requireConfigFile: false
|
|
4
|
-
},
|
|
5
|
-
env: {
|
|
6
|
-
jest: true
|
|
7
|
-
},
|
|
8
|
-
extends: ['standard', 'plugin:prettier/recommended'],
|
|
9
|
-
ignorePatterns: ['!.github', '!.storybook'],
|
|
10
|
-
plugins: ['simple-import-sort'],
|
|
11
|
-
rules: {
|
|
12
|
-
'simple-import-sort/imports': 'error',
|
|
13
|
-
'simple-import-sort/exports': 'error'
|
|
14
|
-
},
|
|
15
|
-
overrides: [
|
|
16
|
-
// JSON
|
|
17
|
-
{
|
|
18
|
-
files: ['*.json'],
|
|
19
|
-
plugins: ['json-format'],
|
|
20
|
-
settings: {
|
|
21
|
-
'json/json-with-comments-files': [],
|
|
22
|
-
'json/sort-package-json': false
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
// Typescript
|
|
26
|
-
{
|
|
27
|
-
files: ['*.ts?(x)'],
|
|
28
|
-
extends: ['love', 'plugin:prettier/recommended'],
|
|
29
|
-
parserOptions: {
|
|
30
|
-
project: './tsconfig.json',
|
|
31
|
-
warnOnUnsupportedTypeScriptVersion: false
|
|
32
|
-
},
|
|
33
|
-
plugins: ['tsc'],
|
|
34
|
-
rules: {
|
|
35
|
-
'tsc/config': [
|
|
36
|
-
'error',
|
|
37
|
-
{
|
|
38
|
-
configFile: './tsconfig.json'
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
'@typescript-eslint/consistent-type-assertions': [
|
|
42
|
-
'error',
|
|
43
|
-
{
|
|
44
|
-
assertionStyle: 'as',
|
|
45
|
-
objectLiteralTypeAssertions: 'allow'
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
49
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
50
|
-
'@typescript-eslint/strict-boolean-expressions': 'off'
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
// React
|
|
54
|
-
{
|
|
55
|
-
files: ['*.{js,ts,md}x'],
|
|
56
|
-
env: {
|
|
57
|
-
browser: true
|
|
58
|
-
},
|
|
59
|
-
extends: [
|
|
60
|
-
'standard-react',
|
|
61
|
-
'standard-jsx',
|
|
62
|
-
'plugin:prettier/recommended',
|
|
63
|
-
'plugin:jsx-a11y/recommended',
|
|
64
|
-
'plugin:mdx/recommended'
|
|
65
|
-
],
|
|
66
|
-
rules: {
|
|
67
|
-
// Overrides standard-react
|
|
68
|
-
'jsx-quotes': ['error', 'prefer-double']
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
// Storybook
|
|
72
|
-
{
|
|
73
|
-
files: ['**/*.stories.*'],
|
|
74
|
-
extends: ['plugin:storybook/recommended', 'plugin:storybook/csf-strict'],
|
|
75
|
-
rules: {
|
|
76
|
-
'storybook/meta-inline-properties': 'error'
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
// Testing Library
|
|
80
|
-
{
|
|
81
|
-
files: ['**/*.spec.*'],
|
|
82
|
-
extends: ['plugin:testing-library/react'],
|
|
83
|
-
rules: {
|
|
84
|
-
'testing-library/no-node-access': [
|
|
85
|
-
'error',
|
|
86
|
-
{ allowContainerFirstChild: true }
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
// Cypress
|
|
91
|
-
{
|
|
92
|
-
files: ['**/*.cy.*'],
|
|
93
|
-
extends: ['plugin:cypress/recommended']
|
|
94
|
-
}
|
|
95
|
-
]
|
|
96
|
-
}
|