@fullstacksjs/eslint-config 8.0.0 → 8.2.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
@@ -70,6 +70,7 @@ It reads your root `package.json` dependencies and includes necessary rules.
70
70
  "@fullstacksjs/eslint-config/strict",
71
71
  "@fullstacksjs/eslint-config/cypress",
72
72
  "@fullstacksjs/eslint-config/storybook",
73
+ "@fullstacksjs/eslint-config/graphql", // Need extra config
73
74
  "@fullstacksjs/eslint-config/esm", // for native ESM modules
74
75
  "@fullstacksjs/eslint-config/typecheck" // ⚠️ Needs configurations (not included in default config)
75
76
  ]
@@ -92,6 +93,30 @@ If you need more advanced `typescript-eslint` rules, then you can extend from `"
92
93
  }
93
94
  ```
94
95
 
96
+ ## Graphql
97
+
98
+ To enable graphql module you need to extends from `@fullstacksjs/eslint-config/graphql` and configure schema and operations in you eslint config or graphql config. for more information checkout [here](https://github.com/B2o5T/graphql-eslint#configuration).
99
+
100
+ Here is an example:
101
+
102
+ ```jsonc
103
+ // eslintrc
104
+
105
+ {
106
+ "extends": [
107
+ ...
108
+ "@fullstacksjs/eslint-config/eslint"
109
+ ],
110
+ }
111
+ ```
112
+
113
+ ```yaml
114
+ # .graphqlrc.yml
115
+
116
+ schema: 'path/to/schema'
117
+ ```
118
+
119
+
95
120
  ## What's included?
96
121
 
97
122
  * @typescript-eslint/eslint-plugin
@@ -108,6 +133,7 @@ If you need more advanced `typescript-eslint` rules, then you can extend from `"
108
133
  * eslint-plugin-node
109
134
  * eslint-plugin-promise
110
135
  * eslint-plugin-storybook
136
+ * eslint-plugin-graphql
111
137
 
112
138
  That's all. Feel free to use 💛
113
139
 
package/base.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type { import('eslint').Linter.Config } */
1
2
  module.exports = {
2
3
  plugins: ['prettier', 'import', 'simple-import-sort', 'promise', 'node', 'fp'],
3
4
  parserOptions: {
package/cypress.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type { import('eslint').Linter.Config } */
1
2
  module.exports = {
2
3
  overrides: [
3
4
  {
package/esm.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type { import('eslint').Linter.Config } */
1
2
  module.exports = {
2
3
  rules: {
3
4
  'import/extensions': 'off',
package/graphql.js ADDED
@@ -0,0 +1,11 @@
1
+ /** @type { import('eslint').Linter.Config } */
2
+ module.exports = {
3
+ overrides: [
4
+ {
5
+ files: ['*.graphql', '*.gql'],
6
+ parser: '@graphql-eslint/eslint-plugin',
7
+ plugins: ['@graphql-eslint'],
8
+ extends: './rules/graphql.js',
9
+ },
10
+ ],
11
+ };
package/index.js CHANGED
@@ -8,9 +8,11 @@ const { packageJson: pkg } = readPkgUp.sync({
8
8
 
9
9
  const packages = Packages(pkg);
10
10
 
11
+ /** @type { import('eslint').Linter.Config } */
11
12
  module.exports = {
12
13
  extends: [
13
14
  require.resolve('./base'),
15
+ require.resolve('./storybook'),
14
16
  packages.ifAnyDep('jest', () => require.resolve('./jest')),
15
17
  packages.ifAnyDep('react', () => require.resolve('./react')),
16
18
  packages.ifAnyDep('typescript', () => require.resolve('./typescript')),
package/jest.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const exts = '(js|jsx|ts|tsx)';
2
2
  const dirs = '(test|tests|__test__|__tests__|spec|specs)';
3
3
 
4
+ /** @type { import('eslint').Linter.Config } */
4
5
  module.exports = {
5
6
  overrides: [
6
7
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstacksjs/eslint-config",
3
- "version": "8.0.0",
3
+ "version": "8.2.0",
4
4
  "license": "MIT",
5
5
  "author": "fullstacks <fullstacksjs@gmail.com>",
6
6
  "description": "fullstacks eslint config",
@@ -22,6 +22,7 @@
22
22
  "jest.js",
23
23
  "cypress.js",
24
24
  "storybook.js",
25
+ "graphql.js",
25
26
  "react.js",
26
27
  "typescript.js",
27
28
  "typecheck.js",
@@ -34,6 +35,8 @@
34
35
  "check-rules:react": "eslint-find-rules --no-core --unused ./tests/react.js",
35
36
  "check-rules:typescript": "eslint-find-rules --no-core --unused ./tests/typescript.js",
36
37
  "check-rules:cypress": "eslint-find-rules --no-core --unused ./tests/cypress.js",
38
+ "check-rules:graphql": "eslint-find-rules --no-core --unused ./tests/graphql.js",
39
+ "check-rules:storybook": "eslint-find-rules --no-core --unused ./tests/storybook.js",
37
40
  "test": "npm-run-all --parallel check-rules:*",
38
41
  "prepublishOnly": "pinst --disable",
39
42
  "postpublish": "pinst --enable",
@@ -42,20 +45,21 @@
42
45
  "main": "index.js",
43
46
  "dependencies": {
44
47
  "@frontendmonster/utils": "0.3.11",
45
- "@typescript-eslint/eslint-plugin": "5.6.0",
46
- "@typescript-eslint/parser": "5.6.0",
48
+ "@graphql-eslint/eslint-plugin": "3.8.0",
49
+ "@typescript-eslint/eslint-plugin": "5.10.2",
50
+ "@typescript-eslint/parser": "5.10.2",
47
51
  "eslint-config-prettier": "8.3.0",
48
52
  "eslint-import-resolver-typescript": "2.5.0",
49
53
  "eslint-plugin-cypress": "2.12.1",
50
54
  "eslint-plugin-fp": "2.3.0",
51
- "eslint-plugin-import": "2.25.3",
52
- "eslint-plugin-jest": "25.3.0",
55
+ "eslint-plugin-import": "2.25.4",
56
+ "eslint-plugin-jest": "26.1.0",
53
57
  "eslint-plugin-jest-formatting": "3.1.0",
54
58
  "eslint-plugin-jsx-a11y": "6.5.1",
55
59
  "eslint-plugin-node": "11.1.0",
56
60
  "eslint-plugin-prettier": "4.0.0",
57
61
  "eslint-plugin-promise": "6.0.0",
58
- "eslint-plugin-react": "7.27.1",
62
+ "eslint-plugin-react": "7.28.0",
59
63
  "eslint-plugin-react-hooks": "4.3.0",
60
64
  "eslint-plugin-simple-import-sort": "7.0.0",
61
65
  "eslint-plugin-storybook": "0.5.6",
@@ -66,15 +70,15 @@
66
70
  "yargs": "17.3.1"
67
71
  },
68
72
  "devDependencies": {
69
- "eslint": "8.5.0",
70
- "eslint-find-rules": "4.0.0",
73
+ "eslint": "8.8.0",
74
+ "eslint-find-rules": "4.1.0",
71
75
  "husky": "7.0.4",
72
- "lint-staged": "12.1.2",
76
+ "lint-staged": "12.3.3",
73
77
  "np": "7.6.0",
74
78
  "npm-run-all": "4.1.5",
75
79
  "pinst": "2.1.6",
76
80
  "prettier": "2.5.1",
77
- "typescript": "4.5.4"
81
+ "typescript": "4.5.5"
78
82
  },
79
83
  "peerDependencies": {
80
84
  "cypress": ">=8",
package/react.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type { import('eslint').Linter.Config } */
1
2
  module.exports = {
2
3
  plugins: ['react', 'react-hooks', 'jsx-a11y'],
3
4
  parserOptions: {
@@ -0,0 +1,62 @@
1
+ /** @type { import('eslint').Linter.Config } */
2
+ module.exports = {
3
+ rules: {
4
+ '@graphql-eslint/alphabetize': ['warn', { fields: ['ObjectTypeDefinition'] }],
5
+ '@graphql-eslint/description-style': 'warn',
6
+ '@graphql-eslint/executable-definitions': 'off',
7
+ '@graphql-eslint/fields-on-correct-type': 'warn',
8
+ '@graphql-eslint/fragments-on-composite-type': 'warn',
9
+ '@graphql-eslint/input-name': 'warn',
10
+ '@graphql-eslint/known-argument-names': 'warn',
11
+ '@graphql-eslint/known-directives': 'warn',
12
+ '@graphql-eslint/known-fragment-names': 'warn',
13
+ '@graphql-eslint/known-type-names': 'warn',
14
+ '@graphql-eslint/lone-anonymous-operation': 'warn',
15
+ '@graphql-eslint/lone-schema-definition': 'warn',
16
+ '@graphql-eslint/match-document-filename': ['warn', { query: 'camelCase', mutation: 'camelCase', subscription: 'camelCase' }],
17
+ '@graphql-eslint/naming-convention': 'warn',
18
+ '@graphql-eslint/no-anonymous-operations': 'warn',
19
+ '@graphql-eslint/no-case-insensitive-enum-values-duplicates': 'warn',
20
+ '@graphql-eslint/no-deprecated': 'warn',
21
+ '@graphql-eslint/no-duplicate-fields': 'warn',
22
+ '@graphql-eslint/no-fragment-cycles': 'warn',
23
+ '@graphql-eslint/no-hashtag-description': 'warn',
24
+ '@graphql-eslint/no-root-type': 'off',
25
+ '@graphql-eslint/no-scalar-result-type-on-mutation': 'warn',
26
+ '@graphql-eslint/no-typename-prefix': 'warn',
27
+ '@graphql-eslint/no-undefined-variables': 'warn',
28
+ '@graphql-eslint/no-unreachable-types': 'warn',
29
+ '@graphql-eslint/no-unused-fields': 'warn',
30
+ '@graphql-eslint/no-unused-fragments': 'warn',
31
+ '@graphql-eslint/no-unused-variables': 'warn',
32
+ '@graphql-eslint/one-field-subscriptions': 'warn',
33
+ '@graphql-eslint/overlapping-fields-can-be-merged': 'warn',
34
+ '@graphql-eslint/possible-fragment-spread': 'warn',
35
+ '@graphql-eslint/possible-type-extension': 'warn',
36
+ '@graphql-eslint/provided-required-arguments': 'warn',
37
+ '@graphql-eslint/require-deprecation-date': 'warn',
38
+ '@graphql-eslint/require-deprecation-reason': 'warn',
39
+ '@graphql-eslint/require-description': 'off',
40
+ '@graphql-eslint/require-field-of-type-query-in-mutation-result': 'warn',
41
+ '@graphql-eslint/require-id-when-available': 'warn',
42
+ '@graphql-eslint/scalar-leafs': 'warn',
43
+ '@graphql-eslint/selection-set-depth': 'off',
44
+ '@graphql-eslint/strict-id-in-types': 'warn',
45
+ '@graphql-eslint/unique-argument-names': 'warn',
46
+ '@graphql-eslint/unique-directive-names': 'warn',
47
+ '@graphql-eslint/unique-directive-names-per-location': 'warn',
48
+ '@graphql-eslint/unique-enum-value-names': 'warn',
49
+ '@graphql-eslint/unique-field-definition-names': 'warn',
50
+ '@graphql-eslint/unique-fragment-name': 'warn',
51
+ '@graphql-eslint/unique-input-field-names': 'warn',
52
+ '@graphql-eslint/unique-operation-name': 'warn',
53
+ '@graphql-eslint/unique-operation-types': 'warn',
54
+ '@graphql-eslint/unique-type-names': 'warn',
55
+ '@graphql-eslint/unique-variable-names': 'warn',
56
+ '@graphql-eslint/value-literals-of-correct-type': 'warn',
57
+ '@graphql-eslint/variables-are-input-types': 'warn',
58
+ '@graphql-eslint/variables-in-allowed-position': 'warn',
59
+
60
+ 'spaced-comment': 'off',
61
+ },
62
+ };
package/rules/jest.js CHANGED
@@ -7,6 +7,7 @@ module.exports = {
7
7
  'jest/no-alias-methods': 'off',
8
8
  'jest/no-commented-out-tests': 'warn',
9
9
  'jest/no-conditional-expect': 'error',
10
+ 'jest/no-conditional-in-test': 'error',
10
11
  'jest/no-deprecated-functions': 'error',
11
12
  'jest/no-disabled-tests': 'warn',
12
13
  'jest/no-done-callback': 'warn',
@@ -16,7 +17,6 @@ module.exports = {
16
17
  'jest/no-focused-tests': 'error',
17
18
  'jest/no-hooks': 'off',
18
19
  'jest/no-identical-title': 'error',
19
- 'jest/no-if': 'error',
20
20
  'jest/no-interpolation-in-snapshots': 'error',
21
21
  'jest/no-jasmine-globals': 'off',
22
22
  'jest/no-jest-import': 'error',
@@ -34,6 +34,7 @@ module.exports = {
34
34
  'jest/prefer-hooks-on-top': 'error',
35
35
  'jest/prefer-inline-snapshots': 'off',
36
36
  'jest/prefer-lowercase-title': 'off',
37
+ 'jest/prefer-snapshot-hint': 'warn',
37
38
  'jest/prefer-spy-on': 'off',
38
39
  'jest/prefer-strict-equal': 'off',
39
40
  'jest/prefer-to-be-null': 'off',
package/rules/react.js CHANGED
@@ -10,7 +10,7 @@ module.exports = {
10
10
  'react/forbid-elements': 'off',
11
11
  'react/forbid-foreign-prop-types': 'error',
12
12
  'react/forbid-prop-types': 'off',
13
- 'react/function-component-definition': 'off',
13
+ 'react/function-component-definition': ['warn', { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' }],
14
14
  'react/jsx-boolean-value': 'off',
15
15
  'react/jsx-child-element-spacing': 'warn',
16
16
  'react/jsx-curly-brace-presence': ['warn', { props: 'never', children: 'ignore' }],
@@ -68,10 +68,10 @@ module.exports = {
68
68
  'react/no-unused-state': 'error',
69
69
  'react/no-will-update-set-state': 'error',
70
70
  'react/prefer-es6-class': 'off',
71
+ 'react/prefer-exact-props': 'off',
71
72
  'react/prefer-read-only-props': 'off',
72
73
  'react/prefer-stateless-function': 'off',
73
74
  'react/prop-types': 'off',
74
- 'react/prefer-exact-props': 'off',
75
75
  'react/react-in-jsx-scope': 'off', // jsx automatic runtime
76
76
  'react/require-default-props': 'off',
77
77
  'react/require-optimization': 'off',
@@ -13,5 +13,6 @@ module.exports = {
13
13
  'storybook/csf-component': 'warn',
14
14
  'storybook/no-stories-of': 'warn',
15
15
  'storybook/no-title-property-in-meta': 'warn',
16
+ 'storybook/meta-inline-properties': 'off',
16
17
  },
17
18
  };
package/rules/strict.js CHANGED
@@ -28,7 +28,7 @@ module.exports = {
28
28
  {
29
29
  selector: 'parameter',
30
30
  format: ['camelCase', 'PascalCase'],
31
- leadingUnderscore: 'allow',
31
+ leadingUnderscore: 'allowSingleOrDouble',
32
32
  },
33
33
  {
34
34
  selector: 'memberLike',
@@ -47,7 +47,7 @@ module.exports = {
47
47
  {
48
48
  selector: 'parameter',
49
49
  format: ['camelCase', 'PascalCase'],
50
- leadingUnderscore: 'allow',
50
+ leadingUnderscore: 'allowSingleOrDouble',
51
51
  },
52
52
  {
53
53
  selector: 'memberLike',
package/storybook.js CHANGED
@@ -1,7 +1,8 @@
1
+ /** @type { import('eslint').Linter.Config } */
1
2
  module.exports = {
2
3
  overrides: [
3
4
  {
4
- plugin: ['storybook'],
5
+ plugins: ['storybook'],
5
6
  files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '*.story.@(ts|tsx|js|jsx|mjs|cjs)'],
6
7
  extends: ['./rules/storybook.js'],
7
8
  },
package/typecheck.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type { import('eslint').Linter.Config } */
1
2
  module.exports = {
2
3
  overrides: [
3
4
  {
package/typescript.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type { import('eslint').Linter.Config } */
1
2
  module.exports = {
2
3
  parser: '@typescript-eslint/parser',
3
4
  plugins: ['@typescript-eslint/eslint-plugin'],