@shayanthenerd/eslint-config 0.4.5 → 0.4.6

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 (65) hide show
  1. package/dist/configs/base.js +43 -0
  2. package/dist/configs/commons.js +26 -0
  3. package/dist/configs/css.js +28 -0
  4. package/dist/configs/cypress.js +22 -0
  5. package/dist/configs/html.js +22 -0
  6. package/dist/configs/importX.js +45 -0
  7. package/dist/configs/nuxtMultiRootTemplate.js +14 -0
  8. package/dist/configs/oxlintOverrides.js +50 -0
  9. package/dist/configs/perfectionist.js +23 -0
  10. package/dist/configs/playwright.js +22 -0
  11. package/dist/configs/storybook.js +23 -0
  12. package/dist/configs/stylistic.js +22 -0
  13. package/dist/configs/tailwind.js +42 -0
  14. package/dist/configs/typescript.js +30 -0
  15. package/dist/configs/vitest.js +22 -0
  16. package/dist/configs/vue.js +34 -0
  17. package/dist/configs/vueComponentNames.js +19 -0
  18. package/dist/index.d.ts +16 -0
  19. package/dist/index.js +54 -0
  20. package/dist/oxlint.config.jsonc +192 -0
  21. package/dist/prettier.config.d.ts +6 -0
  22. package/dist/prettier.config.js +38 -0
  23. package/dist/rules/css.js +65 -0
  24. package/dist/rules/cypress.js +15 -0
  25. package/dist/rules/html.js +53 -0
  26. package/dist/rules/importX.js +50 -0
  27. package/dist/rules/javascript.js +163 -0
  28. package/dist/rules/perfectionist.js +73 -0
  29. package/dist/rules/playwright.js +27 -0
  30. package/dist/rules/storybook.js +15 -0
  31. package/dist/rules/stylistic.js +160 -0
  32. package/dist/rules/tailwind.js +36 -0
  33. package/dist/rules/typescript.js +62 -0
  34. package/dist/rules/vitest.js +46 -0
  35. package/dist/rules/vue.js +171 -0
  36. package/dist/rules/vueAccessibility.js +23 -0
  37. package/dist/types/configOptions/base.d.ts +47 -0
  38. package/dist/types/configOptions/css.d.ts +27 -0
  39. package/dist/types/configOptions/html.d.ts +27 -0
  40. package/dist/types/configOptions/importX.d.ts +29 -0
  41. package/dist/types/configOptions/nuxt.d.ts +42 -0
  42. package/dist/types/configOptions/perfectionist.d.ts +16 -0
  43. package/dist/types/configOptions/stylistic.d.ts +145 -0
  44. package/dist/types/configOptions/tailwind.d.ts +46 -0
  45. package/dist/types/configOptions/test.d.ts +55 -0
  46. package/dist/types/configOptions/typescript.d.ts +36 -0
  47. package/dist/types/configOptions/vue.d.ts +211 -0
  48. package/dist/types/configOptions/vueAccessibility.d.ts +34 -0
  49. package/dist/types/eslint-schema.d.ts +13732 -0
  50. package/dist/types/eslintRules.d.ts +12 -0
  51. package/dist/types/helpers.d.ts +5 -0
  52. package/dist/types/index.d.ts +360 -0
  53. package/dist/utils/globs.js +31 -0
  54. package/dist/utils/ignores/defaultIgnorePatterns.js +57 -0
  55. package/dist/utils/ignores/getIgnorePatterns.js +16 -0
  56. package/dist/utils/ignores/resolveGitignorePatterns.js +26 -0
  57. package/dist/utils/isEmptyString.js +7 -0
  58. package/dist/utils/isEnabled.js +7 -0
  59. package/dist/utils/isPackageDetected.js +20 -0
  60. package/dist/utils/options/defaultOptions.js +168 -0
  61. package/dist/utils/options/enableDetectedConfigs.js +40 -0
  62. package/dist/utils/options/mergeWithDefaults.js +21 -0
  63. package/dist/utils/vue/getRestrictedVueElements.js +27 -0
  64. package/dist/utils/vue/getRestrictedVueInputs.js +23 -0
  65. package/package.json +2 -1
@@ -0,0 +1,192 @@
1
+ {
2
+ "$schema": "../node_modules/oxlint/configuration_schema.json",
3
+
4
+ "env": {
5
+ "builtin": true,
6
+ "es2026": true,
7
+ "commonjs": false,
8
+ "node": true,
9
+ "browser": true,
10
+ "worker": true,
11
+ "serviceworker": false,
12
+ "webextensions": false
13
+ },
14
+
15
+ "categories": {
16
+ "correctness": "error",
17
+ "suspicious": "error",
18
+ "restriction": "error",
19
+ "pedantic": "error",
20
+ "perf": "warn",
21
+ "style": "warn",
22
+ "nursery": "error"
23
+ },
24
+
25
+ "plugins": [
26
+ "oxc",
27
+ "node",
28
+ "jest",
29
+ "jsdoc",
30
+ "eslint",
31
+ "import",
32
+ "vitest",
33
+ "promise",
34
+ "unicorn",
35
+ "jsx-a11y",
36
+ "typescript"
37
+ ],
38
+
39
+ "rules": {
40
+ /*** OXC ***/
41
+ "oxc/no-async-await": "off",
42
+ "oxc/no-optional-chaining": "off",
43
+ "oxc/no-rest-spread-properties": "off",
44
+
45
+ /*** ESLint ***/
46
+ "eslint/yoda": "error",
47
+ "eslint/alert": "warn",
48
+ "eslint/id-length": "off",
49
+ "eslint/sort-vars": "off",
50
+ "eslint/sort-keys": "off",
51
+ "eslint/no-ternary": "off",
52
+ "eslint/no-undefined": "off",
53
+ "eslint/sort-imports": "off",
54
+ "eslint/no-magic-numbers": "off",
55
+ "eslint/arrow-body-style": "off",
56
+ "eslint/no-duplicate-imports": "off",
57
+ "eslint/func-names": ["error", "as-needed"],
58
+
59
+ "eslint/no-console": [
60
+ "warn",
61
+ {
62
+ "allow": ["info", "warn", "error", "table", "group", "groupEnd", "groupCollapsed"]
63
+ }
64
+ ],
65
+
66
+ /*** TypeScript ***/
67
+ "typescript/triple-slash-reference": "off",
68
+ "typescript/explicit-function-return-type": "off",
69
+ "typescript/consistent-indexed-object-style": ["warn", "record"],
70
+
71
+ /*** Import ***/
72
+ "import/unambiguous": "off",
73
+ "import/no-namespace": "off",
74
+ "import/exports-last": "off",
75
+ "import/max-dependencies": "off",
76
+ "import/no-default-export": "off",
77
+ "import/prefer-default-export": "off",
78
+ "import/no-named-as-default-member": "off",
79
+ "import/no-anonymous-default-export": "off",
80
+
81
+ /*** Unicorn ***/
82
+ "unicorn/filename-case": "off",
83
+ "unicorn/prefer-set-has": "off",
84
+ "unicorn/no-array-reduce": "off",
85
+ "unicorn/prefer-string-raw": "off",
86
+ "unicorn/no-array-for-each": "off",
87
+ "unicorn/no-useless-undefined": "off",
88
+ "unicorn/prefer-prototype-methods": "off",
89
+ "unicorn/no-await-expression-member": "off",
90
+
91
+ /*** Jest ***/
92
+ "jest/require-hook": "off",
93
+ "jest/prefer-lowercase-title": "warn",
94
+ "jest/require-top-level-describe": "off",
95
+
96
+ /*** Customizable Overrides ***/
97
+ /* These rules are customizable in the ESLint config, but OXLint doesn't respect them. */
98
+ "eslint/max-depth": "off",
99
+ "eslint/func-style": "off",
100
+ "eslint/max-nested-callbacks": "off",
101
+ "typescript/consistent-type-definitions": "off",
102
+ "import/extensions": "off",
103
+ "vitest/consistent-test-it": "off",
104
+ "jest/max-nested-describe": "off"
105
+ },
106
+
107
+ "overrides": [
108
+ {
109
+ "files": ["**/{src,app,server}/**/*.{vue,js,mjs,cjs,jsx,ts,mts,cts,tsx}"],
110
+ "rules": {
111
+ "eslint/no-undef": "off"
112
+ }
113
+ },
114
+ {
115
+ "files": [
116
+ "**/{shared,dto,dtos,model,models,helper,helpers,module,modules,@type,@types,types,util,utils,utilities,composable,composables,repo,repos,repository,repositories}/**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"
117
+ ],
118
+ "rules": {
119
+ "typescript/explicit-function-return-type": "error"
120
+ }
121
+ }
122
+ ],
123
+
124
+ "ignorePatterns": [
125
+ /* Dependencies */
126
+ "**/*.min.*",
127
+ "**/jspm_packages",
128
+ "**/pnpm-lock.yaml",
129
+ "**/bower_components",
130
+ "**/package-lock.json",
131
+
132
+ /* Auto-generated type definitions */
133
+ "**/typegen.d.ts",
134
+ "**/components.d.ts",
135
+ "**/auto-import?(s).d.ts",
136
+
137
+ /* Build outputs */
138
+ "**/out",
139
+ "**/dist",
140
+ "**/build",
141
+ "**/.data",
142
+ "**/output",
143
+ "**/.output",
144
+ "**/.serverless",
145
+ "**/public/build",
146
+ "**/public/static",
147
+ "**/.eslint-config-inspector",
148
+
149
+ /* Cache */
150
+ "**/tmp",
151
+ "**/.tmp",
152
+ "**/.npm",
153
+ "**/temp",
154
+ "**/.temp",
155
+ "**/cache",
156
+ "**/.cache",
157
+ "**/deno_dir",
158
+ "**/.parcel-cache",
159
+ "**/*.lerna_backup",
160
+ "**/.postcss-cache",
161
+ "**/.vitepress/cache",
162
+ "**/vite.config.*.timestamp-*",
163
+
164
+ /* Frameworks and tools */
165
+ "**/.nx",
166
+ "**/.vite",
167
+ "**/.yarn",
168
+ "**/.nuxt",
169
+ "**/.next",
170
+ "**/.vitest",
171
+ "**/.vercel",
172
+ "**/.svelte-kit",
173
+ "**/.vite-inspect",
174
+
175
+ /* Tests */
176
+ "**/coverage",
177
+ "**/_fixtures",
178
+ "**/.nyc_output",
179
+ "**/__snapshots__",
180
+
181
+ /* Development environment */
182
+ "**/.idea",
183
+ "**/.fleet",
184
+ "**/.history",
185
+
186
+ // Documentation
187
+ "**/LICENSE*",
188
+ "**/CHANGELOG*.md",
189
+ "**/CODEOWNERS.md",
190
+ "**/CODE_OF_CONDUCT.md"
191
+ ]
192
+ }
@@ -0,0 +1,6 @@
1
+ import { Config } from "prettier";
2
+
3
+ //#region src/prettier.config.d.ts
4
+ declare const prettierConfig: Config;
5
+ //#endregion
6
+ export { prettierConfig as default };
@@ -0,0 +1,38 @@
1
+ //#region src/prettier.config.ts
2
+ const prettierConfig = {
3
+ semi: true,
4
+ useTabs: true,
5
+ tabWidth: 2,
6
+ vueIndentScriptAndStyle: false,
7
+ printWidth: 120,
8
+ singleQuote: true,
9
+ jsxSingleQuote: false,
10
+ quoteProps: "consistent",
11
+ insertPragma: false,
12
+ requirePragma: false,
13
+ bracketSpacing: true,
14
+ bracketSameLine: false,
15
+ endOfLine: "lf",
16
+ trailingComma: "all",
17
+ arrowParens: "always",
18
+ proseWrap: "preserve",
19
+ objectWrap: "preserve",
20
+ singleAttributePerLine: false,
21
+ htmlWhitespaceSensitivity: "css",
22
+ embeddedLanguageFormatting: "auto",
23
+ rangeStart: 0,
24
+ rangeEnd: Number.POSITIVE_INFINITY,
25
+ experimentalTernaries: false,
26
+ experimentalOperatorPosition: "end",
27
+ overrides: [{
28
+ files: ["*.jsonc", "bun.lock"],
29
+ options: { parser: "json" }
30
+ }, {
31
+ files: "*.svg",
32
+ options: { parser: "html" }
33
+ }]
34
+ };
35
+ var prettier_config_default = prettierConfig;
36
+
37
+ //#endregion
38
+ export { prettier_config_default as default };
@@ -0,0 +1,65 @@
1
+ import { isEnabled } from "../utils/isEnabled.js";
2
+ import { defaultOptions } from "../utils/options/defaultOptions.js";
3
+
4
+ //#region src/rules/css.ts
5
+ const allowedPhysicalUnits = [
6
+ "cqh",
7
+ "cqw",
8
+ "dvh",
9
+ "dvw",
10
+ "lvh",
11
+ "lvw",
12
+ "svh",
13
+ "svw",
14
+ "vh",
15
+ "vw"
16
+ ];
17
+ const allowedPhysicalProperties = [
18
+ "bottom",
19
+ "border-bottom",
20
+ "border-bottom-color",
21
+ "border-bottom-style",
22
+ "border-bottom-width",
23
+ "border-top",
24
+ "border-top-color",
25
+ "border-top-style",
26
+ "border-top-width",
27
+ "contain-intrinsic-height",
28
+ "contain-intrinsic-width",
29
+ "height",
30
+ "margin-bottom",
31
+ "margin-top",
32
+ "max-height",
33
+ "max-width",
34
+ "min-height",
35
+ "min-width",
36
+ "overflow-x",
37
+ "overflow-y",
38
+ "overscroll-behavior-x",
39
+ "overscroll-behavior-y",
40
+ "padding-bottom",
41
+ "padding-top",
42
+ "scroll-margin-bottom",
43
+ "scroll-margin-top",
44
+ "scroll-padding-bottom",
45
+ "scroll-padding-top",
46
+ "top",
47
+ "width"
48
+ ];
49
+ function getCSSRules(options) {
50
+ const { css } = options.configs;
51
+ const { useBaseline, allowedRelativeFontUnits } = isEnabled(css) ? css : defaultOptions.configs.css;
52
+ const cssRules = {
53
+ "css/no-invalid-properties": ["error", { allowUnknownVariables: true }],
54
+ "css/relative-font-units": ["warn", { allowUnits: allowedRelativeFontUnits }],
55
+ "css/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
56
+ "css/prefer-logical-properties": ["error", {
57
+ allowUnits: allowedPhysicalUnits,
58
+ allowProperties: allowedPhysicalProperties
59
+ }]
60
+ };
61
+ return cssRules;
62
+ }
63
+
64
+ //#endregion
65
+ export { getCSSRules };
@@ -0,0 +1,15 @@
1
+ //#region src/rules/cypress.ts
2
+ function getCypressRules() {
3
+ const cypressRules = {
4
+ "cypress/no-force": "error",
5
+ "cypress/no-pause": "error",
6
+ "cypress/no-xpath": "error",
7
+ "cypress/no-async-tests": "off",
8
+ "cypress/no-chained-get": "error",
9
+ "cypress/assertion-before-screenshot": "error"
10
+ };
11
+ return cypressRules;
12
+ }
13
+
14
+ //#endregion
15
+ export { getCypressRules };
@@ -0,0 +1,53 @@
1
+ import { isEnabled } from "../utils/isEnabled.js";
2
+ import { defaultOptions } from "../utils/options/defaultOptions.js";
3
+
4
+ //#region src/rules/html.ts
5
+ function getHTMLRules(options) {
6
+ const { html, stylistic } = options.configs;
7
+ const { useBaseline, idNamingConvention } = isEnabled(html) ? html : defaultOptions.configs.html;
8
+ const { indent, useTabs, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHTMLElements } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
9
+ const htmlRules = {
10
+ "better-tailwindcss/no-duplicate-classes": "off",
11
+ "@html-eslint/no-target-blank": "error",
12
+ "@html-eslint/no-duplicate-class": "warn",
13
+ "@html-eslint/require-button-type": "error",
14
+ "@html-eslint/no-script-style-type": "error",
15
+ "@html-eslint/require-meta-charset": "error",
16
+ "@html-eslint/quotes": [
17
+ "warn",
18
+ "double",
19
+ { enforceTemplatedAttrValue: true }
20
+ ],
21
+ "@html-eslint/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
22
+ "@html-eslint/require-closing-tags": ["error", {
23
+ selfClosingCustomPatterns: ["-"],
24
+ selfClosing: selfCloseVoidHTMLElements
25
+ }],
26
+ "@html-eslint/require-meta-description": "error",
27
+ "@html-eslint/require-open-graph-protocol": "error",
28
+ "@html-eslint/no-abstract-roles": "error",
29
+ "@html-eslint/no-accesskey-attrs": "error",
30
+ "@html-eslint/require-frame-title": "error",
31
+ "@html-eslint/no-aria-hidden-body": "error",
32
+ "@html-eslint/no-positive-tabindex": "error",
33
+ "@html-eslint/require-meta-viewport": "error",
34
+ "@html-eslint/no-skip-heading-levels": "error",
35
+ "@html-eslint/lowercase": "warn",
36
+ "@html-eslint/no-trailing-spaces": "warn",
37
+ "@html-eslint/indent": ["warn", useTabs ? "tab" : indent],
38
+ "@html-eslint/id-naming-convention": ["warn", idNamingConvention],
39
+ "@html-eslint/element-newline": ["warn", { inline: ["$inline"] }],
40
+ "@html-eslint/attrs-newline": ["warn", { ifAttrsMoreThan: maxAttributesPerLine }],
41
+ "@html-eslint/no-multiple-empty-lines": ["warn", { max: maxConsecutiveEmptyLines }],
42
+ "@html-eslint/no-extra-spacing-attrs": ["warn", {
43
+ disallowTabs: true,
44
+ disallowMissing: true,
45
+ disallowInAssignment: true,
46
+ enforceBeforeSelfClose: true
47
+ }]
48
+ };
49
+ return htmlRules;
50
+ }
51
+
52
+ //#endregion
53
+ export { getHTMLRules };
@@ -0,0 +1,50 @@
1
+ import { isEnabled } from "../utils/isEnabled.js";
2
+ import { defaultOptions } from "../utils/options/defaultOptions.js";
3
+ import path from "node:path";
4
+
5
+ //#region src/rules/importX.ts
6
+ function getImportXRules(options) {
7
+ const { packageDir, configs: { importX } } = options;
8
+ const { removeUnusedImports, requireFileExtension } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
9
+ const importXRules = {
10
+ "unused-imports/no-unused-imports": removeUnusedImports ? "warn" : "off",
11
+ "import-x/extensions": "off",
12
+ "import/extensions": [
13
+ requireFileExtension ? "warn" : "off",
14
+ "always",
15
+ {
16
+ ignorePackages: true,
17
+ checkTypeImports: true
18
+ }
19
+ ],
20
+ "import-x/no-amd": "error",
21
+ "import-x/exports-last": "warn",
22
+ "import-x/no-commonjs": "error",
23
+ "import-x/no-deprecated": "warn",
24
+ "import-x/group-exports": "warn",
25
+ "import-x/no-self-import": "error",
26
+ "import-x/no-absolute-path": "warn",
27
+ "import-x/no-named-default": "error",
28
+ "import-x/no-mutable-exports": "error",
29
+ "import-x/no-empty-named-blocks": "error",
30
+ "import-x/no-named-as-default-member": "off",
31
+ "import-x/no-import-module-exports": "error",
32
+ "import-x/no-useless-path-segments": "error",
33
+ "import-x/consistent-type-specifier-style": "warn",
34
+ "import-x/first": ["warn", "disable-absolute-first"],
35
+ "import-x/namespace": ["error", { allowComputed: true }],
36
+ "import-x/no-duplicates": ["error", { considerQueryString: true }],
37
+ "import-x/no-cycle": ["error", {
38
+ maxDepth: 1,
39
+ ignoreExternal: true
40
+ }],
41
+ "import-x/no-extraneous-dependencies": ["error", {
42
+ includeTypes: true,
43
+ packageDir: path.resolve(packageDir)
44
+ }]
45
+ };
46
+ return importXRules;
47
+ }
48
+
49
+ //#endregion
50
+ export { getImportXRules };
@@ -0,0 +1,163 @@
1
+ //#region src/rules/javascript.ts
2
+ function getJavaScriptRules(options) {
3
+ const { maxDepth, functionStyle, maxNestedCallbacks, preferNamedExports } = options.configs.base;
4
+ const javascriptRules = {
5
+ "no-self-compare": "warn",
6
+ "no-await-in-loop": "error",
7
+ "no-unassigned-vars": "error",
8
+ "no-unreachable-loop": "warn",
9
+ "no-inner-declarations": "warn",
10
+ "require-atomic-updates": "warn",
11
+ "array-callback-return": "error",
12
+ "no-useless-assignment": "error",
13
+ "no-constructor-return": "error",
14
+ "no-async-promise-executor": "error",
15
+ "no-promise-executor-return": "error",
16
+ "no-template-curly-in-string": "error",
17
+ "no-unmodified-loop-condition": "error",
18
+ "use-isnan": ["error", { enforceForIndexOf: true }],
19
+ "no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
20
+ "no-unsafe-negation": ["error", { enforceForOrderingRelations: true }],
21
+ "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
22
+ "no-use-before-define": ["error", {
23
+ functions: false,
24
+ ignoreTypeReferences: false
25
+ }],
26
+ "no-duplicate-imports": ["error", {
27
+ includeExports: true,
28
+ allowSeparateTypeImports: true
29
+ }],
30
+ "yoda": "warn",
31
+ "strict": "error",
32
+ "no-var": "error",
33
+ "eqeqeq": "error",
34
+ "no-new": "error",
35
+ "new-cap": "warn",
36
+ "no-eval": "error",
37
+ "no-void": "error",
38
+ "no-proto": "warn",
39
+ "no-empty": "warn",
40
+ "camelcase": "warn",
41
+ "no-caller": "error",
42
+ "no-eq-null": "warn",
43
+ "complexity": "warn",
44
+ "sort-imports": "off",
45
+ "no-redeclare": "off",
46
+ "no-iterator": "warn",
47
+ "no-continue": "warn",
48
+ "no-new-func": "error",
49
+ "guard-for-in": "warn",
50
+ "no-loop-func": "warn",
51
+ "default-case": "warn",
52
+ "no-lonely-if": "error",
53
+ "no-label-var": "error",
54
+ "no-multi-str": "error",
55
+ "prefer-const": "error",
56
+ "require-await": "warn",
57
+ "dot-notation": "error",
58
+ "no-script-url": "error",
59
+ "no-undef-init": "error",
60
+ "no-extra-bind": "error",
61
+ "prefer-spread": "error",
62
+ "no-lone-blocks": "error",
63
+ "no-extra-label": "error",
64
+ "accessor-pairs": "error",
65
+ "prefer-template": "warn",
66
+ "no-invalid-this": "error",
67
+ "no-useless-call": "error",
68
+ "no-implied-eval": "error",
69
+ "consistent-this": "error",
70
+ "no-octal-escape": "error",
71
+ "no-new-wrappers": "error",
72
+ "block-scoped-var": "warn",
73
+ "object-shorthand": "warn",
74
+ "no-throw-literal": "error",
75
+ "no-extend-native": "error",
76
+ "default-case-last": "warn",
77
+ "no-nested-ternary": "warn",
78
+ "no-useless-return": "error",
79
+ "init-declarations": "error",
80
+ "consistent-return": "error",
81
+ "no-useless-concat": "error",
82
+ "no-useless-rename": "error",
83
+ "default-param-last": "warn",
84
+ "symbol-description": "warn",
85
+ "func-name-matching": "warn",
86
+ "prefer-rest-params": "error",
87
+ "operator-assignment": "error",
88
+ "no-unneeded-ternary": "error",
89
+ "no-implicit-globals": "error",
90
+ "prefer-destructuring": "warn",
91
+ "no-implicit-coercion": "error",
92
+ "no-array-constructor": "error",
93
+ "no-underscore-dangle": "error",
94
+ "prefer-object-spread": "error",
95
+ "radix": ["error", "as-needed"],
96
+ "curly": ["warn", "multi-line"],
97
+ "max-depth": ["warn", maxDepth],
98
+ "no-object-constructor": "error",
99
+ "prefer-object-has-own": "error",
100
+ "no-useless-constructor": "error",
101
+ "class-methods-use-this": "error",
102
+ "prefer-numeric-literals": "error",
103
+ "no-useless-computed-key": "error",
104
+ "prefer-named-capture-group": "warn",
105
+ "no-return-assign": ["error", "always"],
106
+ "prefer-exponentiation-operator": "error",
107
+ "no-bitwise": ["error", { int32Hint: true }],
108
+ "max-params": ["warn", { countVoidThis: true }],
109
+ "logical-assignment-operators": ["error", "always"],
110
+ "max-nested-callbacks": ["warn", maxNestedCallbacks],
111
+ "no-sequences": ["error", { allowInParentheses: false }],
112
+ "no-multi-assign": ["error", { ignoreNonDeclaration: true }],
113
+ "no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
114
+ "prefer-arrow-callback": ["error", { allowUnboundThis: true }],
115
+ "no-shadow-restricted-names": ["warn", { reportGlobalThis: true }],
116
+ "func-style": [
117
+ "warn",
118
+ functionStyle,
119
+ { allowTypeAnnotation: true }
120
+ ],
121
+ "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
122
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
123
+ "no-extra-boolean-cast": ["error", { enforceForInnerExpressions: true }],
124
+ "no-console": ["warn", { allow: [
125
+ "info",
126
+ "warn",
127
+ "error",
128
+ "table",
129
+ "group",
130
+ "groupEnd",
131
+ "groupCollapsed"
132
+ ] }],
133
+ "no-shadow": ["error", {
134
+ hoist: "all",
135
+ allow: ["name"],
136
+ builtinGlobals: true,
137
+ ignoreTypeValueShadow: false,
138
+ ignoreFunctionTypeParameterNameValueShadow: false
139
+ }],
140
+ "no-restricted-exports": [preferNamedExports ? "error" : "off", { restrictDefaultExports: {
141
+ named: true,
142
+ namedFrom: true,
143
+ defaultFrom: true,
144
+ namespaceFrom: true
145
+ } }],
146
+ "no-empty-function": ["error", { allow: [
147
+ "overrideMethods",
148
+ "decoratedFunctions",
149
+ "privateConstructors",
150
+ "protectedConstructors"
151
+ ] }],
152
+ "no-unused-expressions": ["error", {
153
+ allowTernary: true,
154
+ enforceForJSX: true,
155
+ allowShortCircuit: true,
156
+ allowTaggedTemplates: true
157
+ }]
158
+ };
159
+ return javascriptRules;
160
+ }
161
+
162
+ //#endregion
163
+ export { getJavaScriptRules };
@@ -0,0 +1,73 @@
1
+ import { isEnabled } from "../utils/isEnabled.js";
2
+ import { defaultOptions } from "../utils/options/defaultOptions.js";
3
+
4
+ //#region src/rules/perfectionist.ts
5
+ function getPerfectionistRules(options) {
6
+ const { env, tsConfig, configs: { stylistic, perfectionist } } = options;
7
+ const { maxLineLength } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
8
+ const { sortType } = isEnabled(perfectionist) ? perfectionist : defaultOptions.configs.perfectionist;
9
+ const perfectionistRules = {
10
+ "perfectionist/sort-maps": "warn",
11
+ "perfectionist/sort-exports": "warn",
12
+ "perfectionist/sort-union-types": "warn",
13
+ "perfectionist/sort-array-includes": "warn",
14
+ "perfectionist/sort-intersection-types": "warn",
15
+ "perfectionist/sort-named-imports": ["warn", { groupKind: "types-first" }],
16
+ "perfectionist/sort-named-exports": ["warn", { groupKind: "types-first" }],
17
+ "perfectionist/sort-imports": ["warn", {
18
+ environment: env,
19
+ tsconfig: tsConfig || void 0,
20
+ sortSideEffects: true,
21
+ fallbackSort: {
22
+ order: "asc",
23
+ type: "natural"
24
+ },
25
+ partitionByComment: true,
26
+ specialCharacters: "trim",
27
+ type: sortType,
28
+ maxLineLength,
29
+ customGroups: [{
30
+ groupName: "vue-sfc",
31
+ elementNamePattern: ["\\.(vue|[jt]sx)$"]
32
+ }, {
33
+ groupName: "image",
34
+ elementNamePattern: ["\\.(ico|svg|gif|png|jpe?g|webp|avif|heic)$"]
35
+ }],
36
+ groups: [
37
+ ["style", "side-effect-style"],
38
+ { newlinesBetween: 0 },
39
+ "side-effect",
40
+ "image",
41
+ "vue-sfc",
42
+ "type-external",
43
+ { newlinesBetween: 0 },
44
+ "type-builtin",
45
+ { newlinesBetween: 0 },
46
+ ["type-tsconfig-path", "type-subpath"],
47
+ { newlinesBetween: 0 },
48
+ [
49
+ "type-internal",
50
+ "type-index",
51
+ "type-parent",
52
+ "type-sibling"
53
+ ],
54
+ "external",
55
+ { newlinesBetween: 0 },
56
+ "builtin",
57
+ ["tsconfig-path", "subpath"],
58
+ { newlinesBetween: 0 },
59
+ [
60
+ "internal",
61
+ "index",
62
+ "parent",
63
+ "sibling"
64
+ ],
65
+ ["import", "unknown"]
66
+ ]
67
+ }]
68
+ };
69
+ return perfectionistRules;
70
+ }
71
+
72
+ //#endregion
73
+ export { getPerfectionistRules };
@@ -0,0 +1,27 @@
1
+ //#region src/rules/playwright.ts
2
+ function getPlaywrightRules(options) {
3
+ const { maxNestedDescribe } = options.configs.test;
4
+ const playwrightRules = {
5
+ "playwright/max-expects": "off",
6
+ "playwright/prefer-to-be": "warn",
7
+ "playwright/no-get-by-title": "error",
8
+ "playwright/prefer-to-contain": "warn",
9
+ "playwright/no-wait-for-timeout": "off",
10
+ "playwright/no-duplicate-hooks": "error",
11
+ "playwright/prefer-strict-equal": "warn",
12
+ "playwright/prefer-hooks-on-top": "warn",
13
+ "playwright/prefer-to-have-count": "warn",
14
+ "playwright/prefer-hooks-in-order": "warn",
15
+ "playwright/prefer-to-have-length": "warn",
16
+ "playwright/no-commented-out-tests": "error",
17
+ "playwright/prefer-equality-matcher": "warn",
18
+ "playwright/require-to-throw-message": "error",
19
+ "playwright/prefer-comparison-matcher": "warn",
20
+ "playwright/max-nested-describe": ["warn", { max: maxNestedDescribe }],
21
+ "playwright/prefer-lowercase-title": ["warn", { ignoreTopLevelDescribe: true }]
22
+ };
23
+ return playwrightRules;
24
+ }
25
+
26
+ //#endregion
27
+ export { getPlaywrightRules };