@dvukovic/style-guide 0.3.93 → 0.3.94

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.
Files changed (66) hide show
  1. package/README.md +112 -115
  2. package/package.json +54 -53
  3. package/src/cspell/base.txt +2 -0
  4. package/src/eslint/configs/core.js +35 -19
  5. package/src/eslint/configs/core.test.js +23 -0
  6. package/src/eslint/configs/jest.js +5 -4
  7. package/src/eslint/configs/jest.test.js +17 -0
  8. package/src/eslint/configs/mobx.js +5 -4
  9. package/src/eslint/configs/mobx.test.js +17 -0
  10. package/src/eslint/configs/next.js +5 -4
  11. package/src/eslint/configs/next.test.js +17 -0
  12. package/src/eslint/configs/node.js +6 -4
  13. package/src/eslint/configs/node.test.js +17 -0
  14. package/src/eslint/configs/playwright.js +5 -4
  15. package/src/eslint/configs/playwright.test.js +17 -0
  16. package/src/eslint/configs/react.js +6 -4
  17. package/src/eslint/configs/react.test.js +17 -0
  18. package/src/eslint/configs/storybook.js +15 -10
  19. package/src/eslint/configs/storybook.test.js +17 -0
  20. package/src/eslint/configs/typescript-strict.js +31 -24
  21. package/src/eslint/configs/typescript-strict.test.js +17 -0
  22. package/src/eslint/configs/typescript.js +6 -4
  23. package/src/eslint/configs/typescript.test.js +17 -0
  24. package/src/eslint/configs/vitest.js +5 -4
  25. package/src/eslint/configs/vitest.test.js +17 -0
  26. package/src/eslint/plugins/es-x.js +8 -15
  27. package/src/eslint/plugins/eslint-comments.js +10 -8
  28. package/src/eslint/plugins/eslint.js +13 -8
  29. package/src/eslint/plugins/etc.js +3 -13
  30. package/src/eslint/plugins/import-x.js +8 -4
  31. package/src/eslint/plugins/jest.js +9 -3
  32. package/src/eslint/plugins/mobx.js +8 -3
  33. package/src/eslint/plugins/n.js +8 -3
  34. package/src/eslint/plugins/next.js +8 -3
  35. package/src/eslint/plugins/playwright.js +9 -3
  36. package/src/eslint/plugins/prettier.js +12 -0
  37. package/src/eslint/plugins/promise.js +11 -15
  38. package/src/eslint/plugins/react-hooks.js +8 -3
  39. package/src/eslint/plugins/react.js +13 -4
  40. package/src/eslint/plugins/rimac.js +8 -3
  41. package/src/eslint/plugins/security-node.js +8 -3
  42. package/src/eslint/plugins/simple-import-sort.js +8 -3
  43. package/src/eslint/plugins/sonarjs.js +38 -32
  44. package/src/eslint/plugins/sort-destructure-keys.js +8 -3
  45. package/src/eslint/plugins/sort-keys-fix.js +8 -3
  46. package/src/eslint/plugins/storybook.js +8 -3
  47. package/src/eslint/plugins/stylistic.js +8 -3
  48. package/src/eslint/plugins/typescript-eslint.js +10 -6
  49. package/src/eslint/plugins/typescript-sort-keys.js +8 -3
  50. package/src/eslint/plugins/unicorn.js +20 -3
  51. package/src/eslint/plugins/unused-imports.js +8 -3
  52. package/src/eslint/plugins/vitest.js +30 -5
  53. package/src/package-json/configs/core.js +3 -5
  54. package/src/package-json/plugins/package-json.js +2 -4
  55. package/src/prettier/configs/core.js +6 -4
  56. package/src/prettier/configs/core.test.js +24 -0
  57. package/src/prettier/plugins/embed.js +2 -4
  58. package/src/prettier/plugins/prettier.js +2 -4
  59. package/src/prettier/plugins/sql.js +2 -4
  60. package/src/stylelint/configs/core.js +6 -4
  61. package/src/stylelint/configs/core.test.js +24 -0
  62. package/src/stylelint/plugins/no-unused-selectors.js +2 -4
  63. package/src/stylelint/plugins/order.js +2 -4
  64. package/src/stylelint/plugins/stylelint.js +9 -4
  65. package/src/graphql/configs/core.js +0 -4
  66. package/src/graphql/plugins/graphql.js +0 -96
@@ -1,33 +1,39 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["sonarjs"],
4
- rules: {
5
- "sonarjs/no-all-duplicated-branches": "error",
6
- "sonarjs/no-collapsible-if": "error",
7
- "sonarjs/no-collection-size-mischeck": "error",
8
- "sonarjs/no-duplicated-branches": "error",
9
- "sonarjs/no-element-overwrite": "error",
10
- "sonarjs/no-empty-collection": "error",
11
- "sonarjs/no-gratuitous-expressions": "error",
12
- "sonarjs/no-identical-conditions": "error",
13
- "sonarjs/no-identical-expressions": "error",
14
- "sonarjs/no-identical-functions": "error",
15
- "sonarjs/no-ignored-return": "error",
16
- "sonarjs/no-inverted-boolean-check": "error",
17
- "sonarjs/no-nested-switch": "error",
18
- "sonarjs/no-nested-template-literals": "error",
19
- "sonarjs/no-one-iteration-loop": "error",
20
- "sonarjs/no-redundant-boolean": "error",
21
- "sonarjs/no-redundant-jump": "error",
22
- "sonarjs/no-same-line-conditional": "error",
23
- "sonarjs/no-small-switch": "error",
24
- "sonarjs/no-unused-collection": "error",
25
- "sonarjs/no-use-of-empty-return-value": "error",
26
- "sonarjs/no-useless-catch": "error",
27
- "sonarjs/non-existent-operator": "error",
28
- "sonarjs/prefer-immediate-return": "error",
29
- "sonarjs/prefer-object-literal": "error",
30
- "sonarjs/prefer-single-boolean-return": "error",
31
- "sonarjs/prefer-while": "error",
32
- },
1
+ // sonarjs v3 changed rules significantly - needs manual review
2
+ // import sonarjs from "eslint-plugin-sonarjs"
3
+
4
+ const plugin = {
5
+ // plugins: {
6
+ // sonarjs,
7
+ // },
8
+ // rules: {
9
+ // "sonarjs/no-all-duplicated-branches": "error",
10
+ // "sonarjs/no-collapsible-if": "error",
11
+ // "sonarjs/no-collection-size-mischeck": "error",
12
+ // "sonarjs/no-duplicated-branches": "error",
13
+ // "sonarjs/no-element-overwrite": "error",
14
+ // "sonarjs/no-empty-collection": "error",
15
+ // "sonarjs/no-gratuitous-expressions": "error",
16
+ // "sonarjs/no-identical-conditions": "error",
17
+ // "sonarjs/no-identical-expressions": "error",
18
+ // "sonarjs/no-identical-functions": "error",
19
+ // "sonarjs/no-ignored-return": "error",
20
+ // "sonarjs/no-inverted-boolean-check": "error",
21
+ // "sonarjs/no-nested-switch": "error",
22
+ // "sonarjs/no-nested-template-literals": "error",
23
+ // "sonarjs/no-one-iteration-loop": "error",
24
+ // "sonarjs/no-redundant-boolean": "error",
25
+ // "sonarjs/no-redundant-jump": "error",
26
+ // "sonarjs/no-same-line-conditional": "error",
27
+ // "sonarjs/no-small-switch": "error",
28
+ // "sonarjs/no-unused-collection": "error",
29
+ // "sonarjs/no-use-of-empty-return-value": "error",
30
+ // "sonarjs/no-useless-catch": "error",
31
+ // "sonarjs/non-existent-operator": "error",
32
+ // "sonarjs/prefer-immediate-return": "error",
33
+ // "sonarjs/prefer-object-literal": "error",
34
+ // "sonarjs/prefer-single-boolean-return": "error",
35
+ // "sonarjs/prefer-while": "error",
36
+ // },
33
37
  }
38
+
39
+ export default plugin
@@ -1,7 +1,12 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["sort-destructure-keys"],
1
+ import sortDestructureKeys from "eslint-plugin-sort-destructure-keys"
2
+
3
+ const plugin = {
4
+ plugins: {
5
+ "sort-destructure-keys": sortDestructureKeys,
6
+ },
4
7
  rules: {
5
8
  "sort-destructure-keys/sort-destructure-keys": "error",
6
9
  },
7
10
  }
11
+
12
+ export default plugin
@@ -1,7 +1,12 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["sort-keys-fix"],
1
+ import sortKeysFix from "eslint-plugin-sort-keys-fix"
2
+
3
+ const plugin = {
4
+ plugins: {
5
+ "sort-keys-fix": sortKeysFix,
6
+ },
4
7
  rules: {
5
8
  "sort-keys-fix/sort-keys-fix": "error",
6
9
  },
7
10
  }
11
+
12
+ export default plugin
@@ -1,6 +1,9 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["storybook"],
1
+ import storybook from "eslint-plugin-storybook"
2
+
3
+ const plugin = {
4
+ plugins: {
5
+ storybook,
6
+ },
4
7
  rules: {
5
8
  "storybook/await-interactions": "error",
6
9
  "storybook/context-in-play-function": "error",
@@ -17,3 +20,5 @@ module.exports = {
17
20
  "storybook/use-storybook-testing-library": "error",
18
21
  },
19
22
  }
23
+
24
+ export default plugin
@@ -1,6 +1,9 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["@stylistic"],
1
+ import stylistic from "@stylistic/eslint-plugin"
2
+
3
+ const plugin = {
4
+ plugins: {
5
+ "@stylistic": stylistic,
6
+ },
4
7
  rules: {
5
8
  "@stylistic/lines-between-class-members": ["error", "always"],
6
9
  "@stylistic/padding-line-between-statements": [
@@ -34,3 +37,5 @@ module.exports = {
34
37
  "@stylistic/spaced-comment": ["error", "always", { markers: ["/"] }],
35
38
  },
36
39
  }
40
+
41
+ export default plugin
@@ -1,6 +1,9 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["@typescript-eslint"],
1
+ import typescriptEslint from "typescript-eslint"
2
+
3
+ const plugin = {
4
+ plugins: {
5
+ "@typescript-eslint": typescriptEslint.plugin,
6
+ },
4
7
  rules: {
5
8
  "@typescript-eslint/adjacent-overload-signatures": "error",
6
9
  "@typescript-eslint/array-type": "error",
@@ -66,7 +69,6 @@ module.exports = {
66
69
  "@typescript-eslint/no-duplicate-type-constituents": "error",
67
70
  "@typescript-eslint/no-dynamic-delete": "error",
68
71
  "@typescript-eslint/no-empty-function": "error",
69
- "@typescript-eslint/no-empty-interface": "error",
70
72
  "@typescript-eslint/no-empty-object-type": "error",
71
73
  "@typescript-eslint/no-explicit-any": "error",
72
74
  "@typescript-eslint/no-extra-non-null-assertion": "error",
@@ -78,7 +80,6 @@ module.exports = {
78
80
  "@typescript-eslint/no-inferrable-types": "error",
79
81
  "@typescript-eslint/no-invalid-void-type": "error",
80
82
  "@typescript-eslint/no-loop-func": "error",
81
- "@typescript-eslint/no-loss-of-precision": "error",
82
83
  "@typescript-eslint/no-meaningless-void-operator": [
83
84
  "error",
84
85
  {
@@ -107,6 +108,7 @@ module.exports = {
107
108
  "@typescript-eslint/no-unnecessary-type-arguments": "error",
108
109
  "@typescript-eslint/no-unnecessary-type-assertion": "error",
109
110
  "@typescript-eslint/no-unnecessary-type-constraint": "error",
111
+ "@typescript-eslint/no-unnecessary-type-conversion": "error",
110
112
  "@typescript-eslint/no-unnecessary-type-parameters": "error",
111
113
  "@typescript-eslint/no-unsafe-function-type": "error",
112
114
  "@typescript-eslint/no-unsafe-type-assertion": "off",
@@ -116,6 +118,7 @@ module.exports = {
116
118
  allowTernary: true,
117
119
  },
118
120
  ],
121
+ "@typescript-eslint/no-unused-private-class-members": "error",
119
122
  "@typescript-eslint/no-unused-vars": [
120
123
  "error",
121
124
  {
@@ -178,7 +181,6 @@ module.exports = {
178
181
  "no-empty-function": "off",
179
182
  "no-implied-eval": "off",
180
183
  "no-loop-func": "off",
181
- "no-loss-of-precision": "off",
182
184
  "no-return-await": "off",
183
185
  "no-shadow": "off",
184
186
  "no-throw-literal": "off",
@@ -190,3 +192,5 @@ module.exports = {
190
192
  "require-await": "off",
191
193
  },
192
194
  }
195
+
196
+ export default plugin
@@ -1,8 +1,13 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["typescript-sort-keys"],
1
+ import typescriptSortKeys from "eslint-plugin-typescript-sort-keys"
2
+
3
+ const plugin = {
4
+ plugins: {
5
+ "typescript-sort-keys": typescriptSortKeys,
6
+ },
4
7
  rules: {
5
8
  "typescript-sort-keys/interface": "error",
6
9
  "typescript-sort-keys/string-enum": "error",
7
10
  },
8
11
  }
12
+
13
+ export default plugin
@@ -1,9 +1,13 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["unicorn"],
1
+ import unicorn from "eslint-plugin-unicorn"
2
+
3
+ const plugin = {
4
+ plugins: {
5
+ unicorn,
6
+ },
4
7
  rules: {
5
8
  "unicorn/better-regex": "error",
6
9
  "unicorn/catch-error-name": "error",
10
+ "unicorn/consistent-date-clone": "error",
7
11
  "unicorn/consistent-destructuring": "error",
8
12
  "unicorn/consistent-empty-array-spread": "error",
9
13
  "unicorn/consistent-existence-index-check": "error",
@@ -25,23 +29,28 @@ module.exports = {
25
29
  ],
26
30
  "unicorn/new-for-builtins": "error",
27
31
  "unicorn/no-abusive-eslint-disable": "error",
32
+ "unicorn/no-accessor-recursion": "error",
28
33
  "unicorn/no-anonymous-default-export": "error",
29
34
  "unicorn/no-array-callback-reference": "error",
30
35
  "unicorn/no-array-method-this-argument": "error",
31
36
  "unicorn/no-array-push-push": "error",
32
37
  "unicorn/no-array-reduce": "error",
38
+ "unicorn/no-array-reverse": "error",
33
39
  "unicorn/no-await-expression-member": "error",
34
40
  "unicorn/no-await-in-promise-methods": "error",
35
41
  "unicorn/no-console-spaces": "error",
36
42
  "unicorn/no-document-cookie": "error",
37
43
  "unicorn/no-empty-file": "error",
38
44
  "unicorn/no-for-loop": "error",
45
+ "unicorn/no-immediate-mutation": "error",
39
46
  "unicorn/no-instanceof-array": "error",
47
+ "unicorn/no-instanceof-builtins": "error",
40
48
  "unicorn/no-invalid-fetch-options": "error",
41
49
  "unicorn/no-invalid-remove-event-listener": "error",
42
50
  "unicorn/no-length-as-slice-end": "error",
43
51
  "unicorn/no-lonely-if": "error",
44
52
  "unicorn/no-magic-array-flat-depth": "error",
53
+ "unicorn/no-named-default": "error",
45
54
  "unicorn/no-negation-in-equality-check": "error",
46
55
  "unicorn/no-new-array": "error",
47
56
  "unicorn/no-new-buffer": "error",
@@ -52,11 +61,15 @@ module.exports = {
52
61
  "unicorn/no-thenable": "error",
53
62
  "unicorn/no-this-assignment": "error",
54
63
  "unicorn/no-typeof-undefined": "error",
64
+ "unicorn/no-unnecessary-array-flat-depth": "error",
65
+ "unicorn/no-unnecessary-array-splice-count": "error",
55
66
  "unicorn/no-unnecessary-await": "error",
56
67
  "unicorn/no-unnecessary-polyfills": "error",
57
68
  "unicorn/no-unreadable-array-destructuring": "error",
58
69
  "unicorn/no-unreadable-iife": "error",
59
70
  "unicorn/no-unused-properties": "error",
71
+ "unicorn/no-useless-collection-argument": "error",
72
+ "unicorn/no-useless-error-capture-stack-trace": "error",
60
73
  "unicorn/no-useless-fallback-in-spread": "error",
61
74
  "unicorn/no-useless-length-check": "error",
62
75
  "unicorn/no-useless-promise-resolve-reject": "error",
@@ -81,6 +94,7 @@ module.exports = {
81
94
  "unicorn/prefer-dom-node-text-content": "error",
82
95
  "unicorn/prefer-event-target": "error",
83
96
  "unicorn/prefer-export-from": ["error", { ignoreUsedVariables: true }],
97
+ "unicorn/prefer-import-meta-properties": "error",
84
98
  "unicorn/prefer-includes": "error",
85
99
  "unicorn/prefer-json-parse-buffer": "error",
86
100
  "unicorn/prefer-keyboard-event-key": "error",
@@ -98,6 +112,7 @@ module.exports = {
98
112
  "unicorn/prefer-query-selector": "error",
99
113
  "unicorn/prefer-reflect-apply": "error",
100
114
  "unicorn/prefer-regexp-test": "error",
115
+ "unicorn/prefer-response-static-json": "error",
101
116
  "unicorn/prefer-set-has": "error",
102
117
  "unicorn/prefer-set-size": "error",
103
118
  "unicorn/prefer-string-raw": "error",
@@ -151,3 +166,5 @@ module.exports = {
151
166
  "unicorn/throw-new-error": "error",
152
167
  },
153
168
  }
169
+
170
+ export default plugin
@@ -1,7 +1,12 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["unused-imports"],
1
+ import unusedImports from "eslint-plugin-unused-imports"
2
+
3
+ const plugin = {
4
+ plugins: {
5
+ "unused-imports": unusedImports,
6
+ },
4
7
  rules: {
5
8
  "unused-imports/no-unused-imports": "error",
6
9
  },
7
10
  }
11
+
12
+ export default plugin
@@ -1,7 +1,19 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- plugins: ["@vitest"],
1
+ import vitest from "@vitest/eslint-plugin"
2
+
3
+ const plugin = {
4
+ plugins: {
5
+ "@vitest": vitest,
6
+ },
4
7
  rules: {
8
+ "@vitest/consistent-each-for": [
9
+ "error",
10
+ {
11
+ describe: "each",
12
+ it: "for",
13
+ suite: "each",
14
+ test: "for",
15
+ },
16
+ ],
5
17
  "@vitest/consistent-test-it": [
6
18
  "error",
7
19
  {
@@ -28,6 +40,7 @@ module.exports = {
28
40
  "@vitest/no-focused-tests": "error",
29
41
  "@vitest/no-identical-title": "error",
30
42
  "@vitest/no-import-node-test": "error",
43
+ "@vitest/no-importing-vitest-globals": "error",
31
44
  "@vitest/no-interpolation-in-snapshots": "error",
32
45
  "@vitest/no-large-snapshots": "error",
33
46
  "@vitest/no-mocks-import": "error",
@@ -40,6 +53,8 @@ module.exports = {
40
53
  "@vitest/no-test-prefixes": "error",
41
54
  "@vitest/no-test-return-statement": "error",
42
55
  "@vitest/padding-around-all": "error",
56
+ "@vitest/prefer-called-exactly-once-with": "error",
57
+ "@vitest/prefer-called-once": "error",
43
58
  "@vitest/prefer-called-with": "error",
44
59
  "@vitest/prefer-comparison-matcher": "error",
45
60
  "@vitest/prefer-each": "error",
@@ -50,15 +65,22 @@ module.exports = {
50
65
  "@vitest/prefer-lowercase-title": "error",
51
66
  "@vitest/prefer-mock-promise-shorthand": "error",
52
67
  "@vitest/prefer-spy-on": "error",
68
+ "@vitest/prefer-strict-boolean-matchers": "error",
53
69
  "@vitest/prefer-strict-equal": "error",
54
70
  "@vitest/prefer-to-be": "error",
55
- "@vitest/prefer-to-be-falsy": "error",
56
71
  "@vitest/prefer-to-be-object": "error",
57
- "@vitest/prefer-to-be-truthy": "error",
58
72
  "@vitest/prefer-to-contain": "error",
59
73
  "@vitest/prefer-to-have-length": "error",
60
74
  "@vitest/prefer-todo": "error",
61
75
  "@vitest/prefer-vi-mocked": "error",
76
+ "@vitest/require-awaited-expect-poll": "error",
77
+ "@vitest/require-import-vi-mock": "error",
78
+ "@vitest/require-mock-type-parameters": [
79
+ "error",
80
+ {
81
+ checkImportFunctions: false,
82
+ },
83
+ ],
62
84
  "@vitest/require-to-throw-message": "error",
63
85
  "@vitest/require-top-level-describe": [
64
86
  "error",
@@ -70,5 +92,8 @@ module.exports = {
70
92
  "@vitest/valid-expect": "error",
71
93
  "@vitest/valid-expect-in-promise": "error",
72
94
  "@vitest/valid-title": "error",
95
+ "@vitest/warn-todo": "warn",
73
96
  },
74
97
  }
98
+
99
+ export default plugin
@@ -1,10 +1,8 @@
1
- const { packageJsonCore } = require("../plugins/package-json.js")
1
+ import packageJsonCore from "../plugins/package-json.js"
2
2
 
3
3
  /** @type {import("npm-package-json-lint/dist/src/configuration").Config} */
4
4
  const config = {
5
- rules: {
6
- ...packageJsonCore.rules,
7
- },
5
+ ...packageJsonCore,
8
6
  }
9
7
 
10
- module.exports = config
8
+ export default config
@@ -1,5 +1,5 @@
1
1
  /** @type {import("npm-package-json-lint/dist/src/configuration").Config} */
2
- const packageJsonCore = {
2
+ const plugin = {
3
3
  rules: {
4
4
  "bin-type": "error",
5
5
  "bundledDependencies-type": "error",
@@ -78,6 +78,4 @@ const packageJsonCore = {
78
78
  },
79
79
  }
80
80
 
81
- module.exports = {
82
- packageJsonCore,
83
- }
81
+ export default plugin
@@ -1,9 +1,9 @@
1
- const { prettierPluginEmbed } = require("../plugins/embed.js")
2
- const { prettierPluginSql } = require("../plugins/sql.js")
3
- const { prettierPlugin } = require("../plugins/prettier.js")
1
+ import prettierPluginEmbed from "../plugins/embed.js"
2
+ import prettierPlugin from "../plugins/prettier.js"
3
+ import prettierPluginSql from "../plugins/sql.js"
4
4
 
5
5
  /** @type {import("prettier").Config} */
6
- module.exports = {
6
+ const config = {
7
7
  plugins: [
8
8
  "prettier-plugin-prisma",
9
9
  "prettier-plugin-sql",
@@ -18,3 +18,5 @@ module.exports = {
18
18
  ...prettierPluginSql,
19
19
  ...prettierPluginEmbed,
20
20
  }
21
+
22
+ export default config
@@ -0,0 +1,24 @@
1
+ import { format } from "prettier"
2
+
3
+ import config from "./core.js"
4
+
5
+ describe("prettier core", () => {
6
+ test("loads without errors", async () => {
7
+ const result = await format("const x = 1", {
8
+ ...config,
9
+ parser: "babel",
10
+ })
11
+
12
+ expect(result).toBeDefined()
13
+ expect(typeof result).toBe("string")
14
+ })
15
+
16
+ test("formats code correctly", async () => {
17
+ const result = await format("const x=1", {
18
+ ...config,
19
+ parser: "babel",
20
+ })
21
+
22
+ expect(result).toContain("const x = 1")
23
+ })
24
+ })
@@ -1,8 +1,6 @@
1
1
  /** @type {import("prettier-plugin-embed").PrettierPluginEmbedOptions} */
2
- const prettierPluginEmbed = {
2
+ const plugin = {
3
3
  embeddedSqlTags: ["sql"],
4
4
  }
5
5
 
6
- module.exports = {
7
- prettierPluginEmbed,
8
- }
6
+ export default plugin
@@ -1,5 +1,5 @@
1
1
  /** @type {import("prettier").Config} */
2
- const prettierPlugin = {
2
+ const plugin = {
3
3
  arrowParens: "always",
4
4
  bracketSameLine: false,
5
5
  bracketSpacing: true,
@@ -18,6 +18,4 @@ const prettierPlugin = {
18
18
  useTabs: false,
19
19
  }
20
20
 
21
- module.exports = {
22
- prettierPlugin,
23
- }
21
+ export default plugin
@@ -1,9 +1,7 @@
1
1
  /** @type {import("prettier-plugin-sql").SqlBaseOptions} */
2
- const prettierPluginSql = {
2
+ const plugin = {
3
3
  keywordCase: "upper",
4
4
  language: "postgresql",
5
5
  }
6
6
 
7
- module.exports = {
8
- prettierPluginSql,
9
- }
7
+ export default plugin
@@ -1,9 +1,9 @@
1
- const { stylelint } = require("../plugins/stylelint")
2
- const { stylelintOrder } = require("../plugins/order")
3
- const { stylelintNoUnusedSelectors } = require("../plugins/no-unused-selectors")
1
+ import stylelintNoUnusedSelectors from "../plugins/no-unused-selectors.js"
2
+ import stylelintOrder from "../plugins/order.js"
3
+ import stylelint from "../plugins/stylelint.js"
4
4
 
5
5
  /** @type {import("stylelint").Config} */
6
- module.exports = {
6
+ const config = {
7
7
  allowEmptyInput: true,
8
8
  defaultSeverity: "error",
9
9
  plugins: ["stylelint-order", "stylelint-no-unused-selectors"],
@@ -17,3 +17,5 @@ module.exports = {
17
17
  ...stylelintNoUnusedSelectors.rules,
18
18
  },
19
19
  }
20
+
21
+ export default config
@@ -0,0 +1,24 @@
1
+ import stylelint from "stylelint"
2
+
3
+ import config from "./core.js"
4
+
5
+ describe("stylelint core", () => {
6
+ test("loads without errors", async () => {
7
+ const result = await stylelint.lint({
8
+ code: "a { padding: 10px; }",
9
+ config,
10
+ })
11
+
12
+ expect(result).toBeDefined()
13
+ expect(result.errored).toBe(false)
14
+ })
15
+
16
+ test("detects violations", async () => {
17
+ const result = await stylelint.lint({
18
+ code: "a { color: red;; }",
19
+ config,
20
+ })
21
+
22
+ expect(result.errored).toBe(true)
23
+ })
24
+ })
@@ -1,10 +1,8 @@
1
1
  /** @type {import("stylelint").Config} */
2
- const stylelintNoUnusedSelectors = {
2
+ const plugin = {
3
3
  rules: {
4
4
  "plugin/no-unused-selectors": true,
5
5
  },
6
6
  }
7
7
 
8
- module.exports = {
9
- stylelintNoUnusedSelectors,
10
- }
8
+ export default plugin
@@ -1,5 +1,5 @@
1
1
  /** @type {import("stylelint").Config} */
2
- const stylelintOrder = {
2
+ const plugin = {
3
3
  rules: {
4
4
  "order/order": [
5
5
  "custom-properties",
@@ -14,6 +14,4 @@ const stylelintOrder = {
14
14
  },
15
15
  }
16
16
 
17
- module.exports = {
18
- stylelintOrder,
19
- }
17
+ export default plugin
@@ -1,5 +1,5 @@
1
1
  /** @type {import("stylelint").Config} */
2
- const stylelint = {
2
+ const plugin = {
3
3
  rules: {
4
4
  "alpha-value-notation": "percentage",
5
5
  "annotation-no-unknown": true,
@@ -7,6 +7,7 @@ const stylelint = {
7
7
  "at-rule-no-unknown": [true, { ignoreAtRules: ["theme", "mixin"] }],
8
8
  "at-rule-no-vendor-prefix": true,
9
9
  "block-no-empty": true,
10
+ "block-no-redundant-nested-style-rules": true,
10
11
  "color-function-notation": "modern",
11
12
  "color-hex-length": "long",
12
13
  "color-named": "never",
@@ -38,6 +39,7 @@ const stylelint = {
38
39
  "keyframe-block-no-duplicate-selectors": true,
39
40
  "keyframe-declaration-no-important": true,
40
41
  "keyframe-selector-notation": "percentage",
42
+ "layer-name-pattern": "^[a-z][a-z0-9.-]*$",
41
43
  "length-zero-no-unit": true,
42
44
  "lightness-notation": "percentage",
43
45
  "media-feature-name-no-unknown": true,
@@ -45,16 +47,20 @@ const stylelint = {
45
47
  "media-feature-name-value-no-unknown": true,
46
48
  "media-feature-range-notation": "prefix",
47
49
  "media-query-no-invalid": true,
50
+ "media-type-no-deprecated": true,
48
51
  "named-grid-areas-no-invalid": true,
52
+ "nesting-selector-no-missing-scoping-root": true,
49
53
  "no-descending-specificity": true,
50
54
  "no-duplicate-at-import-rules": true,
51
55
  "no-duplicate-selectors": true,
52
56
  "no-empty-source": true,
53
57
  "no-invalid-double-slash-comments": true,
54
58
  "no-invalid-position-at-import-rule": true,
59
+ "no-invalid-position-declaration": true,
55
60
  "no-irregular-whitespace": true,
56
61
  "no-unknown-animations": true,
57
62
  "number-max-precision": 3,
63
+ "property-no-deprecated": true,
58
64
  "property-no-unknown": true,
59
65
  "property-no-vendor-prefix": true,
60
66
  "rule-empty-line-before": [
@@ -75,6 +81,7 @@ const stylelint = {
75
81
  "selector-type-no-unknown": true,
76
82
  "shorthand-property-no-redundant-values": true,
77
83
  "string-no-newline": true,
84
+ "syntax-string-no-invalid": true,
78
85
  "unit-allowed-list": ["px", "rem", "%", "fr", "vw", "vh", "s", "deg", "ms"],
79
86
  "unit-no-unknown": true,
80
87
  "value-keyword-case": "lower",
@@ -82,6 +89,4 @@ const stylelint = {
82
89
  },
83
90
  }
84
91
 
85
- module.exports = {
86
- stylelint,
87
- }
92
+ export default plugin