@petbee/eslint-config 1.0.15 → 1.0.17
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/eslint.config.mjs +29 -10
- package/package.json +52 -2
package/eslint.config.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import js from '@eslint/js'
|
|
2
2
|
import parser from '@typescript-eslint/parser'
|
|
3
3
|
import tsPlugin from '@typescript-eslint/eslint-plugin'
|
|
4
|
+
import globals from 'globals'
|
|
4
5
|
|
|
5
6
|
import prettierConfig from './rules/prettier.js'
|
|
6
7
|
import errorsConfig from './rules/errors.js'
|
|
@@ -16,8 +17,28 @@ import testsConfig from './rules/tests.js'
|
|
|
16
17
|
const ensureArray = (config) => {
|
|
17
18
|
if (!config) return []
|
|
18
19
|
if (Array.isArray(config)) return config
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
// Convert legacy config format to flat config format
|
|
22
|
+
if (config.rules || config.extends || config.plugins) {
|
|
23
|
+
const flatConfig = { ...config }
|
|
24
|
+
|
|
25
|
+
// Convert env to languageOptions.globals
|
|
26
|
+
if (flatConfig.env) {
|
|
27
|
+
flatConfig.languageOptions = flatConfig.languageOptions || {}
|
|
28
|
+
flatConfig.languageOptions.globals = flatConfig.languageOptions.globals || {}
|
|
29
|
+
|
|
30
|
+
// Map common environments to globals
|
|
31
|
+
if (flatConfig.env.node) Object.assign(flatConfig.languageOptions.globals, globals.node)
|
|
32
|
+
if (flatConfig.env.jest) Object.assign(flatConfig.languageOptions.globals, globals.jest)
|
|
33
|
+
if (flatConfig.env.es6) Object.assign(flatConfig.languageOptions.globals, globals.es2015)
|
|
34
|
+
|
|
35
|
+
// Remove the env property
|
|
36
|
+
delete flatConfig.env
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return [flatConfig]
|
|
40
|
+
}
|
|
41
|
+
|
|
21
42
|
return []
|
|
22
43
|
}
|
|
23
44
|
|
|
@@ -31,19 +52,17 @@ export default [
|
|
|
31
52
|
project: './tsconfig.json',
|
|
32
53
|
sourceType: 'module',
|
|
33
54
|
},
|
|
55
|
+
globals: {
|
|
56
|
+
...globals.node,
|
|
57
|
+
...globals.jest,
|
|
58
|
+
...globals.es2015,
|
|
59
|
+
__DEV__: true,
|
|
60
|
+
}
|
|
34
61
|
},
|
|
35
62
|
plugins: {
|
|
36
63
|
'@typescript-eslint': tsPlugin,
|
|
37
64
|
},
|
|
38
65
|
settings: {},
|
|
39
|
-
env: {
|
|
40
|
-
node: true,
|
|
41
|
-
jest: true,
|
|
42
|
-
es6: true,
|
|
43
|
-
},
|
|
44
|
-
globals: {
|
|
45
|
-
__DEV__: true,
|
|
46
|
-
},
|
|
47
66
|
},
|
|
48
67
|
...ensureArray(prettierConfig),
|
|
49
68
|
...ensureArray(errorsConfig),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@petbee/eslint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "Petbee's eslint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -16,5 +16,55 @@
|
|
|
16
16
|
},
|
|
17
17
|
"./legacy": "./index.js"
|
|
18
18
|
},
|
|
19
|
-
"
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/petbee/typescript.git",
|
|
22
|
+
"directory": "packages/eslint-config"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"eslint-check": "eslint-config-prettier index.js",
|
|
26
|
+
"dump-config": "eslint-config-prettier index.js > config-dump.json",
|
|
27
|
+
"format": "prettier --ignore-path='.gitignore' --list-different --write .",
|
|
28
|
+
"format:check": "prettier --ignore-path='.gitignore' --check .",
|
|
29
|
+
"lint": "eslint --ignore-path='.gitignore' '{src,tests}/**/*.{ts,tsx}'"
|
|
30
|
+
},
|
|
31
|
+
"eslintConfig": {
|
|
32
|
+
"extends": [
|
|
33
|
+
"petbee"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"prettier": "@petbee/prettier-config",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/petbee/typescript/issues"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@eslint/js": "^9.0.0",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^5.15.0",
|
|
43
|
+
"@typescript-eslint/parser": "^5.15.0",
|
|
44
|
+
"confusing-browser-globals": "^1.0.11",
|
|
45
|
+
"eslint-config-prettier": "^9.0.0",
|
|
46
|
+
"eslint-plugin-cypress": "^2.15.1",
|
|
47
|
+
"eslint-plugin-import": "^2.29.0",
|
|
48
|
+
"eslint-plugin-jest": "^27.6.0",
|
|
49
|
+
"eslint-plugin-node": "^11.1.0",
|
|
50
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
51
|
+
"eslint-plugin-react": "7.33.2",
|
|
52
|
+
"globals": "^13.24.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"eslint": ">=5.0.0",
|
|
56
|
+
"prettier": ">=2.4",
|
|
57
|
+
"typescript": "^4.0.0 || ^5.0.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/react": "18.2.37",
|
|
61
|
+
"eslint": "8.53.0",
|
|
62
|
+
"prettier": "3.0.3",
|
|
63
|
+
"react": "18.2.0",
|
|
64
|
+
"typescript": "5.2.2"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public"
|
|
68
|
+
},
|
|
69
|
+
"gitHead": "60105fc255d4bdf8c41303eda54123b70cacc52c"
|
|
20
70
|
}
|