@foray1010/eslint-config 7.3.0 → 7.3.3
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 +19 -0
- package/README.md +36 -9
- package/eslintignore +0 -1
- package/index.js +1 -0
- package/package.json +11 -3
- package/presets/base.js +9 -9
- package/presets/browser.js +1 -0
- package/presets/node.js +1 -0
- package/presets/react.js +3 -2
- package/tsconfig.json +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.3.3](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.3.2...@foray1010/eslint-config@7.3.3) (2022-08-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @foray1010/eslint-config
|
|
9
|
+
|
|
10
|
+
## [7.3.2](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.3.1...@foray1010/eslint-config@7.3.2) (2022-08-24)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **eslint-config:** disable jsdoc/valid-types ([d1e4e17](https://github.com/foray1010/common-presets/commit/d1e4e17d097adecb3da790248b16a23cfdce34ff))
|
|
15
|
+
- **eslint-config:** do not force react preset to use module ([477f15c](https://github.com/foray1010/common-presets/commit/477f15cd3f8ebdacbe3ab72aaa190054c1300610))
|
|
16
|
+
- import eslint-config-prettier via plugin:prettier/recommended ([53b038b](https://github.com/foray1010/common-presets/commit/53b038bf5ab1f14d87edd4d230fd1f4aa4ae6232))
|
|
17
|
+
- remove unused ignore patterns ([11d05bf](https://github.com/foray1010/common-presets/commit/11d05bf3e7cb001d1260f885089500e1ddf5fb02))
|
|
18
|
+
|
|
19
|
+
## [7.3.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.3.0...@foray1010/eslint-config@7.3.1) (2022-07-28)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- **eslint-config:** allow arrow function in object ([2b7549b](https://github.com/foray1010/common-presets/commit/2b7549ba63f8b9697300becb99504b736c833c23))
|
|
24
|
+
|
|
6
25
|
## [7.3.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.2.0...@foray1010/eslint-config@7.3.0) (2022-07-28)
|
|
7
26
|
|
|
8
27
|
### Features
|
package/README.md
CHANGED
|
@@ -18,18 +18,45 @@ Z for looser rules
|
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
21
|
-
1. `yarn add -DE
|
|
21
|
+
1. `yarn add -DE @foray1010/eslint-config eslint prettier`
|
|
22
22
|
|
|
23
|
-
1. Create an `.eslintrc.
|
|
23
|
+
1. Create an `.eslintrc.cjs` in the project root
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
# for general purpose, support TypeScript
|
|
27
|
-
extends:
|
|
28
|
-
- '@foray1010/eslint-config'
|
|
25
|
+
For general purpose, support TypeScript
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
```js
|
|
28
|
+
'use strict'
|
|
29
|
+
|
|
30
|
+
module.exports = {
|
|
31
|
+
root: true,
|
|
32
|
+
extends: ['@foray1010/eslint-config'],
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For frontend React projects, support TypeScript
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
'use strict'
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
root: true,
|
|
43
|
+
extends: ['@foray1010/eslint-config/react'],
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
For TS projects in monorepo, mark the `tsconfigRootDir` to use the correct `tsconfig.json`
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
'use strict'
|
|
51
|
+
|
|
52
|
+
module.exports = {
|
|
53
|
+
root: true,
|
|
54
|
+
extends: ['@foray1010/eslint-config'],
|
|
55
|
+
parserOptions: {
|
|
56
|
+
// Make sure the correct `tsconfig.json` is found in monorepo
|
|
57
|
+
tsconfigRootDir: __dirname,
|
|
58
|
+
},
|
|
59
|
+
}
|
|
33
60
|
```
|
|
34
61
|
|
|
35
62
|
1. Use default eslintignore via npm script
|
package/eslintignore
CHANGED
package/index.js
CHANGED
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.3.
|
|
4
|
+
"version": "7.3.3",
|
|
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": {
|
|
@@ -19,8 +19,11 @@
|
|
|
19
19
|
"*.md",
|
|
20
20
|
"eslintignore"
|
|
21
21
|
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"type:check": "tsc"
|
|
24
|
+
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"@foray1010/common-presets-utils": "^5.0.
|
|
26
|
+
"@foray1010/common-presets-utils": "^5.0.2",
|
|
24
27
|
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
25
28
|
"@typescript-eslint/parser": "^5.13.0",
|
|
26
29
|
"confusing-browser-globals": "^1.0.10",
|
|
@@ -38,6 +41,11 @@
|
|
|
38
41
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
39
42
|
"eslint-plugin-testing-library": "^5.3.1"
|
|
40
43
|
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/confusing-browser-globals": "1.0.0",
|
|
46
|
+
"@types/eslint": "8.4.6",
|
|
47
|
+
"typescript": "4.7.4"
|
|
48
|
+
},
|
|
41
49
|
"peerDependencies": {
|
|
42
50
|
"eslint": "^8.0.0",
|
|
43
51
|
"prettier": "^2.0.0"
|
|
@@ -48,5 +56,5 @@
|
|
|
48
56
|
"publishConfig": {
|
|
49
57
|
"access": "public"
|
|
50
58
|
},
|
|
51
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "8f4681aea3421297bffa13e0bbbf7f6dba20ca70"
|
|
52
60
|
}
|
package/presets/base.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
// @ts-expect-error
|
|
3
4
|
const { hasDep, isESM } = require('@foray1010/common-presets-utils')
|
|
4
5
|
|
|
5
6
|
const { testFileGlobs } = require('./utils/testUtil')
|
|
6
7
|
|
|
8
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
7
9
|
const esmRules = {
|
|
8
10
|
'import/extensions': [
|
|
9
11
|
'error',
|
|
@@ -12,14 +14,15 @@ const esmRules = {
|
|
|
12
14
|
],
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
/** @type {import('eslint').Linter.Config} */
|
|
15
18
|
module.exports = {
|
|
16
19
|
extends: [
|
|
17
20
|
'eslint:recommended',
|
|
18
21
|
'plugin:eslint-comments/recommended',
|
|
19
22
|
'plugin:import/recommended',
|
|
20
23
|
'plugin:jsdoc/recommended',
|
|
24
|
+
// included eslint-config-prettier
|
|
21
25
|
'plugin:prettier/recommended',
|
|
22
|
-
'eslint-config-prettier',
|
|
23
26
|
],
|
|
24
27
|
parserOptions: {
|
|
25
28
|
ecmaVersion: 2020,
|
|
@@ -83,14 +86,10 @@ module.exports = {
|
|
|
83
86
|
],
|
|
84
87
|
// do not enforce JSDoc for internal methods
|
|
85
88
|
'jsdoc/require-jsdoc': 'off',
|
|
89
|
+
// does not work well with TypeScript https://github.com/gajus/eslint-plugin-jsdoc/issues/145
|
|
90
|
+
'jsdoc/valid-types': 'off',
|
|
86
91
|
// avoid assigning anonymous function to object key which is harder to trace when debug
|
|
87
|
-
'object-shorthand': [
|
|
88
|
-
'error',
|
|
89
|
-
'always',
|
|
90
|
-
{
|
|
91
|
-
avoidExplicitReturnArrows: true,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
92
|
+
'object-shorthand': ['error', 'always'],
|
|
94
93
|
// auto sort export statements
|
|
95
94
|
'simple-import-sort/exports': 'error',
|
|
96
95
|
// auto sort import statements
|
|
@@ -137,7 +136,8 @@ module.exports = {
|
|
|
137
136
|
'plugin:@typescript-eslint/recommended',
|
|
138
137
|
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
139
138
|
'plugin:import/typescript',
|
|
140
|
-
|
|
139
|
+
// included eslint-config-prettier
|
|
140
|
+
'plugin:prettier/recommended',
|
|
141
141
|
],
|
|
142
142
|
parser: '@typescript-eslint/parser',
|
|
143
143
|
parserOptions: {
|
package/presets/browser.js
CHANGED
package/presets/node.js
CHANGED
package/presets/react.js
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
const { testFileGlobs } = require('./utils/testUtil')
|
|
4
4
|
|
|
5
|
+
/** @type {import('eslint').Linter.Config} */
|
|
5
6
|
module.exports = {
|
|
6
7
|
extends: [
|
|
7
8
|
'plugin:react/recommended',
|
|
8
9
|
'plugin:react/jsx-runtime',
|
|
9
10
|
'plugin:react-hooks/recommended',
|
|
10
|
-
|
|
11
|
+
// included eslint-config-prettier
|
|
12
|
+
'plugin:prettier/recommended',
|
|
11
13
|
],
|
|
12
14
|
parserOptions: {
|
|
13
|
-
sourceType: 'module',
|
|
14
15
|
ecmaFeatures: {
|
|
15
16
|
jsx: true,
|
|
16
17
|
},
|