@fullstacksjs/eslint-config 8.2.0 → 8.4.1-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 CHANGED
@@ -58,6 +58,16 @@ Just extend from `@fullstacksjs`:
58
58
 
59
59
  It reads your root `package.json` dependencies and includes necessary rules.
60
60
 
61
+ ## NextJS
62
+
63
+ [NextJS](https://nextjs.org/) config is subset of base config which is compatible with builtin NextJS eslint config.
64
+
65
+ ```json
66
+ {
67
+ "extends": ["@fullstacksjs/eslint-config/nextjs"]
68
+ }
69
+ ```
70
+
61
71
  ## Advanced Usage
62
72
 
63
73
  ```jsonc
package/nextjs.js ADDED
@@ -0,0 +1,40 @@
1
+ const fs = require('fs');
2
+ const { Packages } = require('@frontendmonster/utils');
3
+ const readPkgUp = require('read-pkg-up');
4
+
5
+ const { packageJson: pkg } = readPkgUp.sync({
6
+ cwd: fs.realpathSync(process.cwd()),
7
+ });
8
+
9
+ const packages = Packages(pkg);
10
+
11
+ /** @type { import('eslint').Linter.Config } */
12
+ module.exports = {
13
+ plugins: ['prettier', 'simple-import-sort', 'promise', 'node', 'fp'],
14
+ parserOptions: {
15
+ ecmaVersion: 2020,
16
+ sourceType: 'module',
17
+ requireConfigFile: false,
18
+ },
19
+ env: {
20
+ browser: true,
21
+ es6: true,
22
+ node: true,
23
+ },
24
+ extends: [
25
+ require.resolve('./storybook'),
26
+ packages.ifAnyDep('jest', () => require.resolve('./jest')),
27
+ packages.ifAnyDep('react', () => require.resolve('./react')),
28
+ packages.ifAnyDep('typescript', () => require.resolve('./typescript')),
29
+ packages.ifAnyDep('cypress', () => require.resolve('./cypress')),
30
+ './rules/base',
31
+ './rules/es2015',
32
+ './rules/forbidden',
33
+ './rules/style',
34
+ './rules/variables',
35
+ './rules/fp',
36
+ './rules/promise',
37
+ './rules/node',
38
+ 'prettier',
39
+ ],
40
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstacksjs/eslint-config",
3
- "version": "8.2.0",
3
+ "version": "8.4.1-0",
4
4
  "license": "MIT",
5
5
  "author": "fullstacks <fullstacksjs@gmail.com>",
6
6
  "description": "fullstacks eslint config",
@@ -20,6 +20,7 @@
20
20
  "base.js",
21
21
  "index.js",
22
22
  "jest.js",
23
+ "nextjs.js",
23
24
  "cypress.js",
24
25
  "storybook.js",
25
26
  "graphql.js",
@@ -37,7 +38,8 @@
37
38
  "check-rules:cypress": "eslint-find-rules --no-core --unused ./tests/cypress.js",
38
39
  "check-rules:graphql": "eslint-find-rules --no-core --unused ./tests/graphql.js",
39
40
  "check-rules:storybook": "eslint-find-rules --no-core --unused ./tests/storybook.js",
40
- "test": "npm-run-all --parallel check-rules:*",
41
+ "spell": "cspell ./* --no-progress",
42
+ "test": "npm-run-all --parallel check-rules:* && npm run spell",
41
43
  "prepublishOnly": "pinst --disable",
42
44
  "postpublish": "pinst --enable",
43
45
  "pre-commit": "npm run test && lint-staged"
@@ -45,44 +47,42 @@
45
47
  "main": "index.js",
46
48
  "dependencies": {
47
49
  "@frontendmonster/utils": "0.3.11",
48
- "@graphql-eslint/eslint-plugin": "3.8.0",
49
- "@typescript-eslint/eslint-plugin": "5.10.2",
50
- "@typescript-eslint/parser": "5.10.2",
51
- "eslint-config-prettier": "8.3.0",
52
- "eslint-import-resolver-typescript": "2.5.0",
50
+ "@graphql-eslint/eslint-plugin": "3.10.1",
51
+ "@typescript-eslint/eslint-plugin": "5.17.0",
52
+ "@typescript-eslint/parser": "5.17.0",
53
+ "eslint-config-prettier": "8.5.0",
54
+ "eslint-import-resolver-typescript": "2.7.0",
53
55
  "eslint-plugin-cypress": "2.12.1",
54
56
  "eslint-plugin-fp": "2.3.0",
55
57
  "eslint-plugin-import": "2.25.4",
56
- "eslint-plugin-jest": "26.1.0",
58
+ "eslint-plugin-jest": "26.1.3",
57
59
  "eslint-plugin-jest-formatting": "3.1.0",
58
60
  "eslint-plugin-jsx-a11y": "6.5.1",
59
61
  "eslint-plugin-node": "11.1.0",
60
62
  "eslint-plugin-prettier": "4.0.0",
61
63
  "eslint-plugin-promise": "6.0.0",
62
- "eslint-plugin-react": "7.28.0",
63
- "eslint-plugin-react-hooks": "4.3.0",
64
+ "eslint-plugin-react": "7.29.4",
65
+ "eslint-plugin-react-hooks": "4.4.0",
64
66
  "eslint-plugin-simple-import-sort": "7.0.0",
65
- "eslint-plugin-storybook": "0.5.6",
66
- "inquirer": "8.2.0",
67
- "listr": "0.14.3",
68
- "lodash.has": "4.5.2",
69
- "read-pkg-up": "7.0.1",
70
- "yargs": "17.3.1"
67
+ "eslint-plugin-storybook": "0.5.7",
68
+ "read-pkg-up": "7.0.1"
71
69
  },
72
70
  "devDependencies": {
73
- "eslint": "8.8.0",
71
+ "cspell": "5.19.7",
72
+ "eslint": "8.12.0",
74
73
  "eslint-find-rules": "4.1.0",
75
74
  "husky": "7.0.4",
76
- "lint-staged": "12.3.3",
77
- "np": "7.6.0",
75
+ "lint-staged": "12.3.7",
76
+ "np": "7.6.1",
78
77
  "npm-run-all": "4.1.5",
79
- "pinst": "2.1.6",
80
- "prettier": "2.5.1",
81
- "typescript": "4.5.5"
78
+ "pinst": "3.0.0",
79
+ "prettier": "2.6.1",
80
+ "typescript": "4.6.3"
82
81
  },
83
82
  "peerDependencies": {
84
83
  "cypress": ">=8",
85
84
  "eslint": ">=7",
85
+ "graphql": ">=15",
86
86
  "prettier": "2",
87
87
  "react": ">=16",
88
88
  "typescript": "4"
@@ -99,6 +99,9 @@
99
99
  },
100
100
  "jest": {
101
101
  "optional": true
102
+ },
103
+ "graphql": {
104
+ "optional": true
102
105
  }
103
106
  }
104
107
  }
package/rules/graphql.js CHANGED
@@ -34,6 +34,10 @@ module.exports = {
34
34
  '@graphql-eslint/possible-fragment-spread': 'warn',
35
35
  '@graphql-eslint/possible-type-extension': 'warn',
36
36
  '@graphql-eslint/provided-required-arguments': 'warn',
37
+ '@graphql-eslint/relay-arguments': 'warn',
38
+ '@graphql-eslint/relay-connection-types': 'warn',
39
+ '@graphql-eslint/relay-edge-types': 'warn',
40
+ '@graphql-eslint/relay-page-info': 'warn',
37
41
  '@graphql-eslint/require-deprecation-date': 'warn',
38
42
  '@graphql-eslint/require-deprecation-reason': 'warn',
39
43
  '@graphql-eslint/require-description': 'off',
package/rules/react.js CHANGED
@@ -11,10 +11,12 @@ module.exports = {
11
11
  'react/forbid-foreign-prop-types': 'error',
12
12
  'react/forbid-prop-types': 'off',
13
13
  'react/function-component-definition': ['warn', { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' }],
14
+ 'react/hook-use-state': 'warn',
15
+ 'react/iframe-missing-sandbox': 'error',
14
16
  'react/jsx-boolean-value': 'off',
15
17
  'react/jsx-child-element-spacing': 'warn',
16
18
  'react/jsx-curly-brace-presence': ['warn', { props: 'never', children: 'ignore' }],
17
- 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
19
+ 'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
18
20
  'react/jsx-fragments': 'off',
19
21
  'react/jsx-handler-names': 'off',
20
22
  'react/jsx-key': 'error',
@@ -42,8 +44,8 @@ module.exports = {
42
44
  'react/no-array-index-key': 'warn',
43
45
  'react/no-arrow-function-lifecycle': 'error',
44
46
  'react/no-children-prop': 'off',
45
- 'react/no-danger-with-children': 'error',
46
47
  'react/no-danger': 'off',
48
+ 'react/no-danger-with-children': 'error',
47
49
  'react/no-deprecated': 'error',
48
50
  'react/no-did-mount-set-state': 'error',
49
51
  'react/no-did-update-set-state': 'error',
@@ -6,11 +6,12 @@ module.exports = {
6
6
  'warn',
7
7
  { allowPrivateClassPropertyAccess: false, allowProtectedClassPropertyAccess: false, allowIndexSignaturePropertyAccess: true },
8
8
  ],
9
- '@typescript-eslint/no-meaningless-void-operator': ['warn', { checkNever: false }],
10
9
  '@typescript-eslint/no-confusing-void-expression': ['warn', { ignoreArrowShorthand: true, ignoreVoidOperator: true }],
11
10
  '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
12
11
  '@typescript-eslint/no-implied-eval': 'error',
12
+ '@typescript-eslint/no-meaningless-void-operator': ['warn', { checkNever: false }],
13
13
  '@typescript-eslint/no-misused-promises': 'error',
14
+ '@typescript-eslint/no-redundant-type-constituents': 'warn',
14
15
  '@typescript-eslint/no-throw-literal': 'error',
15
16
  '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
16
17
  '@typescript-eslint/no-unnecessary-qualifier': 'error',
@@ -129,6 +129,7 @@ module.exports = {
129
129
  ],
130
130
  '@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: true }],
131
131
  '@typescript-eslint/no-useless-constructor': 'error',
132
+ '@typescript-eslint/no-useless-empty-export': 'warn',
132
133
  '@typescript-eslint/no-var-requires': 'error',
133
134
  '@typescript-eslint/object-curly-spacing': 'warn',
134
135
  '@typescript-eslint/padding-line-between-statements': ['warn', { blankLine: 'always', prev: ['return'], next: ['export'] }],
@@ -175,6 +176,7 @@ module.exports = {
175
176
  },
176
177
  ],
177
178
  '@typescript-eslint/strict-boolean-expressions': 'off', // Annoying
179
+ '@typescript-eslint/space-before-blocks': 'off',
178
180
 
179
181
  '@typescript-eslint/triple-slash-reference': 'error',
180
182
  '@typescript-eslint/typedef': ['error', { parameter: false, arrowParameter: false, variableDeclaration: false }],
@@ -196,6 +198,7 @@ module.exports = {
196
198
  'no-useless-constructor': 'off',
197
199
  'object-curly-spacing': 'off',
198
200
  'padding-line-between-statements': 'off',
201
+ 'space-before-blocks': 'off',
199
202
 
200
203
  // open issues
201
204
  'react/jsx-no-useless-fragment': 'off', // Need useless-fragment for JSX return type