@foray1010/eslint-config 7.3.4 → 7.4.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/CHANGELOG.md +10 -0
- package/package.json +6 -6
- package/presets/base.js +30 -20
- package/presets/browser.js +4 -0
- package/presets/node.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.4.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.3.4...@foray1010/eslint-config@7.4.0) (2022-09-22)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **eslint-config:** explicitly import node.js only built-in modules ([969c1d2](https://github.com/foray1010/common-presets/commit/969c1d299a3d092eaa373ba9ceca4d7616076cfc))
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **deps:** update dependency eslint-plugin-jest to v27 ([6534504](https://github.com/foray1010/common-presets/commit/65345046f6300b583d7a7b614ed4285486917e4d))
|
|
15
|
+
|
|
6
16
|
## [7.3.4](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.3.3...@foray1010/eslint-config@7.3.4) (2022-08-26)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@foray1010/eslint-config",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.4.0",
|
|
5
5
|
"homepage": "https://github.com/foray1010/common-presets/tree/master/packages/eslint-config#readme",
|
|
6
6
|
"bugs": "https://github.com/foray1010/common-presets/issues",
|
|
7
7
|
"repository": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"type:check": "tsc"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@foray1010/common-presets-utils": "^5.0.
|
|
26
|
+
"@foray1010/common-presets-utils": "^5.0.3",
|
|
27
27
|
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
28
28
|
"@typescript-eslint/parser": "^5.13.0",
|
|
29
29
|
"confusing-browser-globals": "^1.0.10",
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"eslint-plugin-compat": "^4.0.0",
|
|
32
32
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
33
33
|
"eslint-plugin-import": "^2.22.1",
|
|
34
|
-
"eslint-plugin-jest": "^
|
|
34
|
+
"eslint-plugin-jest": "^27.0.0",
|
|
35
35
|
"eslint-plugin-jest-dom": "^4.0.0",
|
|
36
36
|
"eslint-plugin-jsdoc": "^39.0.0",
|
|
37
37
|
"eslint-plugin-n": "^15.2.2",
|
|
38
38
|
"eslint-plugin-prettier": "^4.0.0",
|
|
39
39
|
"eslint-plugin-react": "^7.23.2",
|
|
40
40
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
41
|
-
"eslint-plugin-simple-import-sort": "^
|
|
41
|
+
"eslint-plugin-simple-import-sort": "^8.0.0",
|
|
42
42
|
"eslint-plugin-testing-library": "^5.3.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/confusing-browser-globals": "1.0.0",
|
|
46
46
|
"@types/eslint": "8.4.6",
|
|
47
|
-
"typescript": "4.
|
|
47
|
+
"typescript": "4.8.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"eslint": "^8.0.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "73bd0116236620e7171c9e7c5442afa50bcfbed7"
|
|
60
60
|
}
|
package/presets/base.js
CHANGED
|
@@ -5,13 +5,28 @@ const { hasDep, isESM } = require('@foray1010/common-presets-utils')
|
|
|
5
5
|
|
|
6
6
|
const { testFileGlobs } = require('./utils/testUtil')
|
|
7
7
|
|
|
8
|
-
/** @type {import('eslint').Linter.
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
/** @type {import('eslint').Linter.BaseConfig} */
|
|
9
|
+
const cjsConfig = {
|
|
10
|
+
parserOptions: {
|
|
11
|
+
sourceType: 'script',
|
|
12
|
+
},
|
|
13
|
+
env: {
|
|
14
|
+
commonjs: true,
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** @type {import('eslint').Linter.BaseConfig} */
|
|
19
|
+
const esmConfigForJs = {
|
|
20
|
+
parserOptions: {
|
|
21
|
+
sourceType: 'module',
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
'import/extensions': [
|
|
25
|
+
'error',
|
|
26
|
+
// https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_mandatory_file_extensions
|
|
27
|
+
'always',
|
|
28
|
+
],
|
|
29
|
+
},
|
|
15
30
|
}
|
|
16
31
|
|
|
17
32
|
/** @type {import('eslint').Linter.Config} */
|
|
@@ -26,7 +41,6 @@ module.exports = {
|
|
|
26
41
|
],
|
|
27
42
|
parserOptions: {
|
|
28
43
|
ecmaVersion: 2020,
|
|
29
|
-
sourceType: 'script',
|
|
30
44
|
},
|
|
31
45
|
plugins: [
|
|
32
46
|
'eslint-plugin-eslint-comments',
|
|
@@ -36,7 +50,11 @@ module.exports = {
|
|
|
36
50
|
'eslint-plugin-simple-import-sort',
|
|
37
51
|
],
|
|
38
52
|
env: {
|
|
39
|
-
|
|
53
|
+
/* Not using `node` to explicitly import node.js only built-in modules, e.g.
|
|
54
|
+
* import { Buffer } from 'node:buffer'
|
|
55
|
+
* import process from 'node:process'
|
|
56
|
+
*/
|
|
57
|
+
'shared-node-browser': true,
|
|
40
58
|
},
|
|
41
59
|
rules: {
|
|
42
60
|
// allow disable eslint rules for whole file without re-enable it in the end of the file
|
|
@@ -100,23 +118,15 @@ module.exports = {
|
|
|
100
118
|
overrides: [
|
|
101
119
|
{
|
|
102
120
|
files: ['*.js'],
|
|
103
|
-
|
|
104
|
-
sourceType: isESM() ? 'module' : 'script',
|
|
105
|
-
},
|
|
106
|
-
rules: isESM() ? esmRules : {},
|
|
121
|
+
...(isESM() ? esmConfigForJs : cjsConfig),
|
|
107
122
|
},
|
|
108
123
|
{
|
|
109
124
|
files: ['*.cjs'],
|
|
110
|
-
|
|
111
|
-
sourceType: 'script',
|
|
112
|
-
},
|
|
125
|
+
...cjsConfig,
|
|
113
126
|
},
|
|
114
127
|
{
|
|
115
128
|
files: ['*.mjs'],
|
|
116
|
-
|
|
117
|
-
sourceType: 'module',
|
|
118
|
-
},
|
|
119
|
-
rules: esmRules,
|
|
129
|
+
...esmConfigForJs,
|
|
120
130
|
},
|
|
121
131
|
{
|
|
122
132
|
files: testFileGlobs,
|
package/presets/browser.js
CHANGED
|
@@ -9,6 +9,10 @@ module.exports = {
|
|
|
9
9
|
env: {
|
|
10
10
|
browser: true,
|
|
11
11
|
},
|
|
12
|
+
globals: {
|
|
13
|
+
// keep it until webpack has an official way to define env: https://github.com/webpack/webpack/issues/15833
|
|
14
|
+
process: 'readonly',
|
|
15
|
+
},
|
|
12
16
|
rules: {
|
|
13
17
|
'no-restricted-globals': ['error', ...restrictedGlobals],
|
|
14
18
|
},
|