@dvukovic/style-guide 0.3.14 → 0.3.16

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
@@ -56,7 +56,7 @@ module.exports = {
56
56
  },
57
57
  overrides: [
58
58
  {
59
- files: ["./**/*.{tsx,ts}"],
59
+ files: ["*.ts", "*.tsx"],
60
60
  extends: [
61
61
  require.resolve(
62
62
  "@dvukovic/style-guide/src/eslint/configs/typescript",
@@ -64,7 +64,7 @@ module.exports = {
64
64
  ],
65
65
  },
66
66
  {
67
- files: ["./**/*.test.ts"],
67
+ files: ["*.test.ts"],
68
68
  extends: [
69
69
  require.resolve(
70
70
  "@dvukovic/style-guide/src/eslint/configs/jest",
@@ -75,6 +75,50 @@ module.exports = {
75
75
  }
76
76
  ```
77
77
 
78
+ If you need graphql config, everything has to be configured trough `overrides`
79
+
80
+ ```javascript
81
+ /** @type {import("@types/eslint").ESLint.ConfigData} */
82
+ module.exports = {
83
+ ignorePatterns: ["node_modules"],
84
+ overrides: [
85
+ {
86
+ extends: [
87
+ "./src/eslint/configs/core.js",
88
+ "./src/eslint/configs/node.js",
89
+ "./src/eslint/configs/mobx.js",
90
+ "./src/eslint/configs/react.js",
91
+ "./src/eslint/configs/next.js",
92
+ ],
93
+ files: ["*.js", ".ts", ".*.cjs", "*.tsx"],
94
+ },
95
+ {
96
+ extends: ["./src/eslint/configs/typescript.js"],
97
+ files: ["*.ts", "*.tsx"],
98
+ },
99
+ {
100
+ extends: ["./src/eslint/configs/jest.js"],
101
+ files: ["*.test.ts", "*.test.js"],
102
+ },
103
+ {
104
+ extends: ["./src/graphql/configs/core.js"],
105
+ files: ["*.graphql"],
106
+ parser: "@graphql-eslint/eslint-plugin",
107
+ parserOptions: {
108
+ project: "./tsconfig.json",
109
+ schema: "./**/*.graphql",
110
+ },
111
+ },
112
+ ],
113
+ parser: "@typescript-eslint/parser",
114
+ parserOptions: {
115
+ ecmaVersion: 2024,
116
+ project: "./tsconfig.json",
117
+ },
118
+ root: true,
119
+ }
120
+ ```
121
+
78
122
  ### Prettier
79
123
 
80
124
  Create a `.prettierrc.js` in root with the following:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvukovic/style-guide",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "description": "My own style guide",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,13 +14,14 @@
14
14
  "files": [
15
15
  "src/eslint",
16
16
  "src/cspell",
17
+ "src/graphql",
17
18
  "src/prettier",
18
19
  "src/stylelint",
19
20
  "src/package-json"
20
21
  ],
21
22
  "scripts": {
22
23
  "lint": "yarn lint:prettier && yarn lint:eslint && yarn lint:stylelint && yarn lint:spell && yarn lint:package-json",
23
- "lint:eslint": "eslint . --ext .js,.ts,.tsx --cache",
24
+ "lint:eslint": "eslint . --ext .js,.ts,.tsx,.graphql --cache",
24
25
  "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix && yarn lint:spell && yarn lint:package-json",
25
26
  "lint:package-json": "npmPkgJsonLint --configFile ./.packagerc.js .",
26
27
  "lint:prettier": "prettier --log-level=warn --check --cache .",
@@ -30,6 +31,7 @@
30
31
  },
31
32
  "dependencies": {
32
33
  "@eslint-community/eslint-plugin-eslint-comments": "4.3.0",
34
+ "@graphql-eslint/eslint-plugin": "3.20.1",
33
35
  "@next/eslint-plugin-next": "14.2.5",
34
36
  "@prettier/plugin-xml": "3.4.1",
35
37
  "@stylistic/eslint-plugin": "2.3.0",
@@ -61,13 +63,13 @@
61
63
  "typescript-eslint": "7.17.0"
62
64
  },
63
65
  "devDependencies": {
64
- "@total-typescript/tsconfig": "1.0.4",
65
66
  "@types/eslint": "8.56.11",
66
67
  "@types/jest": "29.5.12",
67
68
  "@types/node": "20.14.12",
68
69
  "@types/react": "18.3.3",
69
70
  "cspell": "8.12.1",
70
71
  "eslint": "8.57.0",
72
+ "graphql": "16.9.0",
71
73
  "jest": "29.7.0",
72
74
  "npm-package-json-lint": "8.0.0",
73
75
  "prettier": "3.3.3",
@@ -78,12 +80,15 @@
78
80
  },
79
81
  "peerDependencies": {
80
82
  "cspell": "8",
81
- "eslint": "8.57",
83
+ "eslint": "8.57.0",
82
84
  "npm-package-json-lint": "8",
83
85
  "prettier": "3",
84
86
  "stylelint": "16"
85
87
  },
86
88
  "peerDependenciesMeta": {
89
+ "cspell": {
90
+ "optional": true
91
+ },
87
92
  "eslint": {
88
93
  "optional": true
89
94
  },
@@ -0,0 +1,4 @@
1
+ /** @type {import("@types/eslint").ESLint.ConfigData} */
2
+ module.exports = {
3
+ extends: ["../plugins/graphql.js"],
4
+ }
@@ -0,0 +1,101 @@
1
+ /** @type {import("@types/eslint").ESLint.ConfigData} */
2
+ module.exports = {
3
+ plugins: ["@graphql-eslint"],
4
+ rules: {
5
+ "@graphql-eslint/alphabetize": [
6
+ "error",
7
+ {
8
+ arguments: [
9
+ "FieldDefinition",
10
+ "Field",
11
+ "DirectiveDefinition",
12
+ "Directive",
13
+ ],
14
+ fields: [
15
+ "InputObjectTypeDefinition",
16
+ "InterfaceTypeDefinition",
17
+ "ObjectTypeDefinition",
18
+ ],
19
+ groups: ["id", "*", "createdAt", "updatedAt"],
20
+ selections: ["FragmentDefinition", "OperationDefinition"],
21
+ variables: ["OperationDefinition"],
22
+ },
23
+ ],
24
+ "@graphql-eslint/description-style": ["error", { style: "block" }],
25
+ "@graphql-eslint/input-name": "error",
26
+ "@graphql-eslint/lone-executable-definition": "error",
27
+ "@graphql-eslint/match-document-filename": [
28
+ "error",
29
+ {
30
+ fileExtension: ".graphql",
31
+ fragment: {
32
+ style: "PascalCase",
33
+ suffix: ".fragment.",
34
+ },
35
+ mutation: {
36
+ style: "PascalCase",
37
+ suffix: ".mutation.",
38
+ },
39
+ query: {
40
+ style: "PascalCase",
41
+ suffix: ".query.",
42
+ },
43
+ subscription: {
44
+ style: "PascalCase",
45
+ suffix: ".subscription.",
46
+ },
47
+ },
48
+ ],
49
+ "@graphql-eslint/naming-convention": [
50
+ "error",
51
+ {
52
+ Argument: "camelCase",
53
+ DirectiveDefinition: "camelCase",
54
+ EnumTypeDefinition: {
55
+ requiredSuffixes: ["Enum"],
56
+ style: "PascalCase",
57
+ },
58
+ EnumValueDefinition: "PascalCase",
59
+ FieldDefinition: "camelCase",
60
+ "FieldDefinition[gqlType.name.value=Boolean]": {
61
+ requiredPrefixes: ["is", "has"],
62
+ style: "camelCase",
63
+ },
64
+ "FieldDefinition[parent.name.value=Mutation]": {
65
+ forbiddenPrefixes: ["mutation"],
66
+ forbiddenSuffixes: ["Mutation"],
67
+ },
68
+
69
+ "FieldDefinition[parent.name.value=Query]": {
70
+ forbiddenPrefixes: ["query", "get"],
71
+ forbiddenSuffixes: ["Query"],
72
+ },
73
+
74
+ "FieldDefinition[parent.name.value=Subscription]": {
75
+ forbiddenPrefixes: ["subscription"],
76
+ forbiddenSuffixes: ["Subscription"],
77
+ },
78
+
79
+ InputValueDefinition: "camelCase",
80
+ InterfaceTypeDefinition: {
81
+ requiredSuffixes: ["Interface"],
82
+ style: "PascalCase",
83
+ },
84
+ types: "PascalCase",
85
+ },
86
+ ],
87
+ "@graphql-eslint/no-anonymous-operations": "error",
88
+ "@graphql-eslint/no-deprecated": "error",
89
+ "@graphql-eslint/no-duplicate-fields": "error",
90
+ "@graphql-eslint/no-hashtag-description": "error",
91
+ "@graphql-eslint/no-scalar-result-type-on-mutation": "error",
92
+ "@graphql-eslint/no-typename-prefix": "error",
93
+ "@graphql-eslint/no-unreachable-types": "error",
94
+ "@graphql-eslint/require-deprecation-date": "error",
95
+ "@graphql-eslint/require-deprecation-reason": "error",
96
+ "@graphql-eslint/strict-id-in-types": "error",
97
+ "@graphql-eslint/unique-enum-value-names": "error",
98
+ "@graphql-eslint/unique-fragment-name": "error",
99
+ "@graphql-eslint/unique-operation-name": "error",
100
+ },
101
+ }