@foray1010/eslint-config 7.3.1 → 7.3.2

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 CHANGED
@@ -3,6 +3,15 @@
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.2](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.3.1...@foray1010/eslint-config@7.3.2) (2022-08-24)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **eslint-config:** disable jsdoc/valid-types ([d1e4e17](https://github.com/foray1010/common-presets/commit/d1e4e17d097adecb3da790248b16a23cfdce34ff))
11
+ - **eslint-config:** do not force react preset to use module ([477f15c](https://github.com/foray1010/common-presets/commit/477f15cd3f8ebdacbe3ab72aaa190054c1300610))
12
+ - import eslint-config-prettier via plugin:prettier/recommended ([53b038b](https://github.com/foray1010/common-presets/commit/53b038bf5ab1f14d87edd4d230fd1f4aa4ae6232))
13
+ - remove unused ignore patterns ([11d05bf](https://github.com/foray1010/common-presets/commit/11d05bf3e7cb001d1260f885089500e1ddf5fb02))
14
+
6
15
  ## [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)
7
16
 
8
17
  ### Bug Fixes
package/README.md CHANGED
@@ -20,16 +20,43 @@ Z for looser rules
20
20
 
21
21
  1. `yarn add -DE eslint prettier @foray1010/eslint-config`
22
22
 
23
- 1. Create an `.eslintrc.yml` in the project root
23
+ 1. Create an `.eslintrc.cjs` in the project root
24
24
 
25
- ```yml
26
- # for general purpose, support TypeScript
27
- extends:
28
- - '@foray1010/eslint-config'
25
+ For general purpose, support TypeScript
29
26
 
30
- # for frontend React project, support TypeScript
31
- extends:
32
- - '@foray1010/eslint-config/react'
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
@@ -4,4 +4,3 @@ build/
4
4
  coverage/
5
5
  dist/
6
6
  node_modules/
7
- out/
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ /** @type {import('eslint').Linter.Config} */
3
4
  module.exports = {
4
5
  extends: ['./presets/base.js', './presets/node.js'],
5
6
  }
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.1",
4
+ "version": "7.3.2",
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.1",
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": "cc2b4de0c590bf0c168149ca38e5c49c384a9b3d"
59
+ "gitHead": "4558b3b10e979f052739e103aef0aad62f3e637b"
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,6 +86,8 @@ 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
92
  'object-shorthand': ['error', 'always'],
88
93
  // auto sort export statements
@@ -131,7 +136,8 @@ module.exports = {
131
136
  'plugin:@typescript-eslint/recommended',
132
137
  'plugin:@typescript-eslint/recommended-requiring-type-checking',
133
138
  'plugin:import/typescript',
134
- 'eslint-config-prettier',
139
+ // included eslint-config-prettier
140
+ 'plugin:prettier/recommended',
135
141
  ],
136
142
  parser: '@typescript-eslint/parser',
137
143
  parserOptions: {
@@ -2,6 +2,7 @@
2
2
 
3
3
  const restrictedGlobals = require('confusing-browser-globals')
4
4
 
5
+ /** @type {import('eslint').Linter.Config} */
5
6
  module.exports = {
6
7
  extends: ['plugin:compat/recommended'],
7
8
  plugins: ['eslint-plugin-compat'],
package/presets/node.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ /** @type {import('eslint').Linter.Config} */
3
4
  module.exports = {
4
5
  plugins: ['eslint-plugin-n'],
5
6
  env: {
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
- 'eslint-config-prettier',
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
  },
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "@foray1010/tsconfig",
4
+ "compilerOptions": {
5
+ "allowJs": true,
6
+ "checkJs": true
7
+ }
8
+ }