@luxass/eslint-config 4.2.5 → 4.2.7

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 (144) hide show
  1. package/README.md +35 -54
  2. package/dist/index.cjs +166 -479
  3. package/dist/index.d.cts +733 -12
  4. package/dist/index.d.ts +733 -12
  5. package/dist/{configs/index.cjs → index.js} +300 -542
  6. package/package.json +51 -86
  7. package/dist/chunk-4YBQZLPS.mjs +0 -68
  8. package/dist/chunk-4YT54JFZ.mjs +0 -48
  9. package/dist/chunk-5NK24IKQ.mjs +0 -26
  10. package/dist/chunk-6T7MXPCT.mjs +0 -17
  11. package/dist/chunk-7ODEIBF5.mjs +0 -144
  12. package/dist/chunk-AQRBQAKE.mjs +0 -48
  13. package/dist/chunk-DAJA5AV3.mjs +0 -29
  14. package/dist/chunk-DCOLHWHC.mjs +0 -269
  15. package/dist/chunk-DVQQVCGF.mjs +0 -45
  16. package/dist/chunk-EHWA727G.mjs +0 -69
  17. package/dist/chunk-FNOIGW47.mjs +0 -104
  18. package/dist/chunk-KOXCJL3C.mjs +0 -109
  19. package/dist/chunk-MMSZW2UW.mjs +0 -92
  20. package/dist/chunk-MT5P5EKH.mjs +0 -207
  21. package/dist/chunk-O2BXTQHK.mjs +0 -117
  22. package/dist/chunk-QDSV5ONX.mjs +0 -93
  23. package/dist/chunk-QMGT2Z63.mjs +0 -57
  24. package/dist/chunk-RVSUTDCE.mjs +0 -57
  25. package/dist/chunk-SPD4DGYN.mjs +0 -274
  26. package/dist/chunk-UITQW3RA.mjs +0 -293
  27. package/dist/chunk-V57HXOSW.mjs +0 -81
  28. package/dist/chunk-WDSV2EFG.mjs +0 -7
  29. package/dist/chunk-WOBGA3K2.mjs +0 -63
  30. package/dist/chunk-WSQOWO67.mjs +0 -16
  31. package/dist/chunk-XBASVDU6.mjs +0 -215
  32. package/dist/chunk-XPKGXA67.mjs +0 -183
  33. package/dist/chunk-YGZJUKJC.mjs +0 -0
  34. package/dist/chunk-YO3IYQ2L.mjs +0 -220
  35. package/dist/configs/astro.cjs +0 -179
  36. package/dist/configs/astro.d.cts +0 -11
  37. package/dist/configs/astro.d.ts +0 -11
  38. package/dist/configs/astro.mjs +0 -8
  39. package/dist/configs/comments.cjs +0 -63
  40. package/dist/configs/comments.d.cts +0 -15
  41. package/dist/configs/comments.d.ts +0 -15
  42. package/dist/configs/comments.mjs +0 -6
  43. package/dist/configs/formatters.cjs +0 -274
  44. package/dist/configs/formatters.d.cts +0 -11
  45. package/dist/configs/formatters.d.ts +0 -11
  46. package/dist/configs/formatters.mjs +0 -9
  47. package/dist/configs/ignores.cjs +0 -96
  48. package/dist/configs/ignores.d.cts +0 -15
  49. package/dist/configs/ignores.d.ts +0 -15
  50. package/dist/configs/ignores.mjs +0 -7
  51. package/dist/configs/imports.cjs +0 -104
  52. package/dist/configs/imports.d.cts +0 -23
  53. package/dist/configs/imports.d.ts +0 -23
  54. package/dist/configs/imports.mjs +0 -7
  55. package/dist/configs/index.d.cts +0 -20
  56. package/dist/configs/index.d.ts +0 -20
  57. package/dist/configs/index.mjs +0 -104
  58. package/dist/configs/javascript.cjs +0 -324
  59. package/dist/configs/javascript.d.cts +0 -11
  60. package/dist/configs/javascript.d.ts +0 -11
  61. package/dist/configs/javascript.mjs +0 -7
  62. package/dist/configs/jsdoc.cjs +0 -85
  63. package/dist/configs/jsdoc.d.cts +0 -27
  64. package/dist/configs/jsdoc.d.ts +0 -27
  65. package/dist/configs/jsdoc.mjs +0 -7
  66. package/dist/configs/jsonc.cjs +0 -155
  67. package/dist/configs/jsonc.d.cts +0 -11
  68. package/dist/configs/jsonc.d.ts +0 -11
  69. package/dist/configs/jsonc.mjs +0 -8
  70. package/dist/configs/markdown.cjs +0 -164
  71. package/dist/configs/markdown.d.cts +0 -35
  72. package/dist/configs/markdown.d.ts +0 -35
  73. package/dist/configs/markdown.mjs +0 -8
  74. package/dist/configs/nextjs.cjs +0 -180
  75. package/dist/configs/nextjs.d.cts +0 -11
  76. package/dist/configs/nextjs.d.ts +0 -11
  77. package/dist/configs/nextjs.mjs +0 -8
  78. package/dist/configs/node.cjs +0 -60
  79. package/dist/configs/node.d.cts +0 -15
  80. package/dist/configs/node.d.ts +0 -15
  81. package/dist/configs/node.mjs +0 -6
  82. package/dist/configs/perfectionist.cjs +0 -51
  83. package/dist/configs/perfectionist.d.cts +0 -20
  84. package/dist/configs/perfectionist.d.ts +0 -20
  85. package/dist/configs/perfectionist.mjs +0 -6
  86. package/dist/configs/react.cjs +0 -379
  87. package/dist/configs/react.d.cts +0 -11
  88. package/dist/configs/react.d.ts +0 -11
  89. package/dist/configs/react.mjs +0 -8
  90. package/dist/configs/solid.cjs +0 -360
  91. package/dist/configs/solid.d.cts +0 -11
  92. package/dist/configs/solid.d.ts +0 -11
  93. package/dist/configs/solid.mjs +0 -8
  94. package/dist/configs/sort.cjs +0 -240
  95. package/dist/configs/sort.d.cts +0 -26
  96. package/dist/configs/sort.d.ts +0 -26
  97. package/dist/configs/sort.mjs +0 -8
  98. package/dist/configs/stylistic.cjs +0 -98
  99. package/dist/configs/stylistic.d.cts +0 -11
  100. package/dist/configs/stylistic.d.ts +0 -11
  101. package/dist/configs/stylistic.mjs +0 -9
  102. package/dist/configs/tailwindcss.cjs +0 -148
  103. package/dist/configs/tailwindcss.d.cts +0 -11
  104. package/dist/configs/tailwindcss.d.ts +0 -11
  105. package/dist/configs/tailwindcss.mjs +0 -8
  106. package/dist/configs/test.cjs +0 -206
  107. package/dist/configs/test.d.cts +0 -11
  108. package/dist/configs/test.d.ts +0 -11
  109. package/dist/configs/test.mjs +0 -9
  110. package/dist/configs/toml.cjs +0 -131
  111. package/dist/configs/toml.d.cts +0 -11
  112. package/dist/configs/toml.d.ts +0 -11
  113. package/dist/configs/toml.mjs +0 -8
  114. package/dist/configs/typescript.cjs +0 -291
  115. package/dist/configs/typescript.d.cts +0 -11
  116. package/dist/configs/typescript.d.ts +0 -11
  117. package/dist/configs/typescript.mjs +0 -8
  118. package/dist/configs/unicorn.cjs +0 -91
  119. package/dist/configs/unicorn.d.cts +0 -15
  120. package/dist/configs/unicorn.d.ts +0 -15
  121. package/dist/configs/unicorn.mjs +0 -6
  122. package/dist/configs/unocss.cjs +0 -133
  123. package/dist/configs/unocss.d.cts +0 -11
  124. package/dist/configs/unocss.d.ts +0 -11
  125. package/dist/configs/unocss.mjs +0 -8
  126. package/dist/configs/vue.cjs +0 -293
  127. package/dist/configs/vue.d.cts +0 -11
  128. package/dist/configs/vue.d.ts +0 -11
  129. package/dist/configs/vue.mjs +0 -8
  130. package/dist/configs/yaml.cjs +0 -143
  131. package/dist/configs/yaml.d.cts +0 -11
  132. package/dist/configs/yaml.d.ts +0 -11
  133. package/dist/configs/yaml.mjs +0 -8
  134. package/dist/custom-rules/utils.cjs +0 -31
  135. package/dist/custom-rules/utils.d.cts +0 -6
  136. package/dist/custom-rules/utils.d.ts +0 -6
  137. package/dist/custom-rules/utils.mjs +0 -6
  138. package/dist/globs.cjs +0 -158
  139. package/dist/globs.d.cts +0 -28
  140. package/dist/globs.d.ts +0 -28
  141. package/dist/globs.mjs +0 -56
  142. package/dist/index.mjs +0 -284
  143. package/dist/types-HqEzZfQU.d.cts +0 -668
  144. package/dist/types-HqEzZfQU.d.ts +0 -668
@@ -1,63 +0,0 @@
1
- import {
2
- ensure,
3
- interop
4
- } from "./chunk-4YBQZLPS.mjs";
5
- import {
6
- GLOB_SRC
7
- } from "./chunk-KOXCJL3C.mjs";
8
-
9
- // src/configs/tailwindcss.ts
10
- async function tailwindcss(options = {}) {
11
- const {
12
- files = [GLOB_SRC],
13
- overrides
14
- } = options;
15
- await ensure([
16
- "eslint-plugin-tailwindcss"
17
- ]);
18
- const [
19
- pluginTailwindCSS
20
- ] = await Promise.all([
21
- interop(import("eslint-plugin-tailwindcss"))
22
- ]);
23
- return [
24
- {
25
- name: "luxass:tailwindcss:setup",
26
- languageOptions: {
27
- parserOptions: {
28
- ecmaFeatures: {
29
- jsx: true
30
- }
31
- }
32
- },
33
- plugins: {
34
- tailwind: pluginTailwindCSS
35
- }
36
- },
37
- {
38
- name: "luxass:tailwindcss:rules",
39
- files,
40
- rules: {
41
- // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/classnames-order.md
42
- "tailwind/classnames-order": "warn",
43
- // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-negative-arbitrary-values.md
44
- "tailwind/enforces-negative-arbitrary-values": "warn",
45
- // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-shorthand.md
46
- "tailwind/enforces-shorthand": "warn",
47
- // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/migration-from-tailwind-2.md
48
- "tailwind/migration-from-tailwind-2": "warn",
49
- // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-arbitrary-value.md
50
- "tailwind/no-arbitrary-value": "off",
51
- // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-contradicting-classname.md
52
- "tailwind/no-contradicting-classname": "error",
53
- // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-custom-classname.md
54
- "tailwind/no-custom-classname": "warn",
55
- ...overrides
56
- }
57
- }
58
- ];
59
- }
60
-
61
- export {
62
- tailwindcss
63
- };
@@ -1,16 +0,0 @@
1
- import {
2
- GLOB_EXCLUDE
3
- } from "./chunk-KOXCJL3C.mjs";
4
-
5
- // src/configs/ignores.ts
6
- function ignores() {
7
- return [
8
- {
9
- ignores: GLOB_EXCLUDE
10
- }
11
- ];
12
- }
13
-
14
- export {
15
- ignores
16
- };
@@ -1,215 +0,0 @@
1
- // src/configs/sort.ts
2
- function sortPackageJson() {
3
- return [
4
- {
5
- name: "luxass:sort-package-json",
6
- files: ["**/package.json"],
7
- rules: {
8
- "jsonc/sort-array-values": [
9
- "error",
10
- {
11
- order: { type: "asc" },
12
- pathPattern: "^files$"
13
- }
14
- ],
15
- "jsonc/sort-keys": [
16
- "error",
17
- {
18
- order: [
19
- "name",
20
- "displayName",
21
- "version",
22
- "description",
23
- "type",
24
- "private",
25
- "author",
26
- "publisher",
27
- "packageManager",
28
- "license",
29
- "funding",
30
- "homepage",
31
- "repository",
32
- "bugs",
33
- "keywords",
34
- "categories",
35
- "sideEffects",
36
- "exports",
37
- "main",
38
- "module",
39
- "unpkg",
40
- "jsdelivr",
41
- "types",
42
- "typesVersions",
43
- "bin",
44
- "icon",
45
- "files",
46
- "engines",
47
- "activationEvents",
48
- "contributes",
49
- "scripts",
50
- "peerDependencies",
51
- "peerDependenciesMeta",
52
- "dependencies",
53
- "optionalDependencies",
54
- "devDependencies",
55
- "pnpm",
56
- "overrides",
57
- "resolutions",
58
- "husky",
59
- "simple-git-hooks",
60
- "lint-staged",
61
- "eslintConfig"
62
- ],
63
- pathPattern: "^$"
64
- },
65
- {
66
- order: { type: "asc" },
67
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
68
- },
69
- {
70
- order: { type: "asc" },
71
- pathPattern: "^resolutions$"
72
- },
73
- {
74
- order: { type: "asc" },
75
- pathPattern: "^pnpm.overrides$"
76
- },
77
- {
78
- order: ["types", "import", "require", "default"],
79
- pathPattern: "^exports.*$"
80
- }
81
- ]
82
- }
83
- }
84
- ];
85
- }
86
- function sortTsconfig() {
87
- return [
88
- {
89
- name: "luxass:sort-tsconfig",
90
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
91
- rules: {
92
- "jsonc/sort-keys": [
93
- "error",
94
- {
95
- order: [
96
- "extends",
97
- "compilerOptions",
98
- "references",
99
- "files",
100
- "include",
101
- "exclude"
102
- ],
103
- pathPattern: "^$"
104
- },
105
- {
106
- order: [
107
- /* Projects */
108
- "incremental",
109
- "composite",
110
- "tsBuildInfoFile",
111
- "disableSourceOfProjectReferenceRedirect",
112
- "disableSolutionSearching",
113
- "disableReferencedProjectLoad",
114
- /* Language and Environment */
115
- "target",
116
- "jsx",
117
- "jsxFactory",
118
- "jsxFragmentFactory",
119
- "jsxImportSource",
120
- "lib",
121
- "moduleDetection",
122
- "noLib",
123
- "reactNamespace",
124
- "useDefineForClassFields",
125
- "emitDecoratorMetadata",
126
- "experimentalDecorators",
127
- /* Modules */
128
- "baseUrl",
129
- "rootDir",
130
- "rootDirs",
131
- "customConditions",
132
- "module",
133
- "moduleResolution",
134
- "moduleSuffixes",
135
- "noResolve",
136
- "paths",
137
- "resolveJsonModule",
138
- "resolvePackageJsonExports",
139
- "resolvePackageJsonImports",
140
- "typeRoots",
141
- "types",
142
- "allowArbitraryExtensions",
143
- "allowImportingTsExtensions",
144
- "allowUmdGlobalAccess",
145
- /* JavaScript Support */
146
- "allowJs",
147
- "checkJs",
148
- "maxNodeModuleJsDepth",
149
- /* Type Checking */
150
- "strict",
151
- "strictBindCallApply",
152
- "strictFunctionTypes",
153
- "strictNullChecks",
154
- "strictPropertyInitialization",
155
- "allowUnreachableCode",
156
- "allowUnusedLabels",
157
- "alwaysStrict",
158
- "exactOptionalPropertyTypes",
159
- "noFallthroughCasesInSwitch",
160
- "noImplicitAny",
161
- "noImplicitOverride",
162
- "noImplicitReturns",
163
- "noImplicitThis",
164
- "noPropertyAccessFromIndexSignature",
165
- "noUncheckedIndexedAccess",
166
- "noUnusedLocals",
167
- "noUnusedParameters",
168
- "useUnknownInCatchVariables",
169
- /* Emit */
170
- "declaration",
171
- "declarationDir",
172
- "declarationMap",
173
- "downlevelIteration",
174
- "emitBOM",
175
- "emitDeclarationOnly",
176
- "importHelpers",
177
- "importsNotUsedAsValues",
178
- "inlineSourceMap",
179
- "inlineSources",
180
- "mapRoot",
181
- "newLine",
182
- "noEmit",
183
- "noEmitHelpers",
184
- "noEmitOnError",
185
- "outDir",
186
- "outFile",
187
- "preserveConstEnums",
188
- "preserveValueImports",
189
- "removeComments",
190
- "sourceMap",
191
- "sourceRoot",
192
- "stripInternal",
193
- /* Interop Constraints */
194
- "allowSyntheticDefaultImports",
195
- "esModuleInterop",
196
- "forceConsistentCasingInFileNames",
197
- "isolatedModules",
198
- "preserveSymlinks",
199
- "verbatimModuleSyntax",
200
- /* Completeness */
201
- "skipDefaultLibCheck",
202
- "skipLibCheck"
203
- ],
204
- pathPattern: "^compilerOptions$"
205
- }
206
- ]
207
- }
208
- }
209
- ];
210
- }
211
-
212
- export {
213
- sortPackageJson,
214
- sortTsconfig
215
- };
@@ -1,183 +0,0 @@
1
- import {
2
- StylisticConfigDefaults
3
- } from "./chunk-QMGT2Z63.mjs";
4
- import {
5
- ensure,
6
- interop
7
- } from "./chunk-4YBQZLPS.mjs";
8
- import {
9
- GLOB_CSS,
10
- GLOB_LESS,
11
- GLOB_MARKDOWN,
12
- GLOB_POSTCSS,
13
- GLOB_SCSS
14
- } from "./chunk-KOXCJL3C.mjs";
15
-
16
- // src/configs/formatters.ts
17
- import * as parserPlain from "eslint-parser-plain";
18
- async function formatters(options = {}, stylistic = {}) {
19
- await ensure([
20
- "eslint-plugin-format"
21
- ]);
22
- if (options === true) {
23
- options = {
24
- css: true,
25
- graphql: true,
26
- html: true,
27
- markdown: true
28
- };
29
- }
30
- const {
31
- indent,
32
- quotes,
33
- semi
34
- } = {
35
- ...StylisticConfigDefaults,
36
- ...stylistic
37
- };
38
- const prettierOptions = Object.assign(
39
- {
40
- endOfLine: "auto",
41
- semi,
42
- singleQuote: quotes === "single",
43
- tabWidth: typeof indent === "number" ? indent : 2,
44
- trailingComma: "all",
45
- useTabs: indent === "tab"
46
- },
47
- options.prettierOptions || {}
48
- );
49
- const dprintOptions = Object.assign(
50
- {
51
- indentWidth: typeof indent === "number" ? indent : 2,
52
- quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
53
- useTabs: indent === "tab"
54
- },
55
- options.dprintOptions || {}
56
- );
57
- const pluginFormat = await interop(import("eslint-plugin-format"));
58
- const configs = [
59
- {
60
- name: "luxass:formatters:setup",
61
- plugins: {
62
- format: pluginFormat
63
- }
64
- }
65
- ];
66
- if (options.css) {
67
- configs.push(
68
- {
69
- name: "luxass:formatter:css",
70
- files: [GLOB_CSS, GLOB_POSTCSS],
71
- languageOptions: {
72
- parser: parserPlain
73
- },
74
- rules: {
75
- "format/prettier": [
76
- "error",
77
- {
78
- ...prettierOptions,
79
- parser: "css"
80
- }
81
- ]
82
- }
83
- },
84
- {
85
- name: "luxass:formatter:scss",
86
- files: [GLOB_SCSS],
87
- languageOptions: {
88
- parser: parserPlain
89
- },
90
- rules: {
91
- "format/prettier": [
92
- "error",
93
- {
94
- ...prettierOptions,
95
- parser: "scss"
96
- }
97
- ]
98
- }
99
- },
100
- {
101
- name: "luxass:formatter:less",
102
- files: [GLOB_LESS],
103
- languageOptions: {
104
- parser: parserPlain
105
- },
106
- rules: {
107
- "format/prettier": [
108
- "error",
109
- {
110
- ...prettierOptions,
111
- parser: "less"
112
- }
113
- ]
114
- }
115
- }
116
- );
117
- }
118
- if (options.html) {
119
- configs.push({
120
- name: "luxass:formatter:html",
121
- files: ["**/*.html"],
122
- languageOptions: {
123
- parser: parserPlain
124
- },
125
- rules: {
126
- "format/prettier": [
127
- "error",
128
- {
129
- ...prettierOptions,
130
- parser: "html"
131
- }
132
- ]
133
- }
134
- });
135
- }
136
- if (options.markdown) {
137
- const formater = options.markdown === true ? "prettier" : options.markdown;
138
- configs.push({
139
- name: "luxass:formatter:markdown",
140
- files: [GLOB_MARKDOWN],
141
- languageOptions: {
142
- parser: parserPlain
143
- },
144
- rules: {
145
- [`format/${formater}`]: [
146
- "error",
147
- formater === "prettier" ? {
148
- printWidth: 120,
149
- ...prettierOptions,
150
- embeddedLanguageFormatting: "off",
151
- parser: "markdown"
152
- } : {
153
- ...dprintOptions,
154
- language: "markdown"
155
- }
156
- ]
157
- }
158
- });
159
- }
160
- if (options.graphql) {
161
- configs.push({
162
- name: "luxass:formatter:graphql",
163
- files: ["**/*.graphql"],
164
- languageOptions: {
165
- parser: parserPlain
166
- },
167
- rules: {
168
- "format/prettier": [
169
- "error",
170
- {
171
- ...prettierOptions,
172
- parser: "graphql"
173
- }
174
- ]
175
- }
176
- });
177
- }
178
- return configs;
179
- }
180
-
181
- export {
182
- formatters
183
- };
File without changes
@@ -1,220 +0,0 @@
1
- import {
2
- interop,
3
- renameRules,
4
- toArray
5
- } from "./chunk-4YBQZLPS.mjs";
6
- import {
7
- GLOB_SRC,
8
- GLOB_SRC_EXT,
9
- GLOB_TS,
10
- GLOB_TSX
11
- } from "./chunk-KOXCJL3C.mjs";
12
-
13
- // src/configs/typescript.ts
14
- import process from "node:process";
15
- import pluginAntfu from "eslint-plugin-antfu";
16
- async function typescript(options = {}) {
17
- const {
18
- exts = [],
19
- overrides = {},
20
- parserOptions = {}
21
- } = options ?? {};
22
- const files = options.files ?? [
23
- GLOB_SRC,
24
- ...exts.map((ext) => `**/*.${ext}`)
25
- ];
26
- const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
27
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
28
- const isTypeAware = !!tsconfigPath;
29
- const typeAwareRules = {
30
- "dot-notation": "off",
31
- "no-implied-eval": "off",
32
- "no-throw-literal": "off",
33
- "ts/await-thenable": "error",
34
- "ts/dot-notation": ["error", { allowKeywords: true }],
35
- "ts/no-floating-promises": "error",
36
- "ts/no-for-in-array": "error",
37
- "ts/no-implied-eval": "error",
38
- "ts/no-misused-promises": "error",
39
- "ts/no-throw-literal": "error",
40
- "ts/no-unnecessary-type-assertion": "error",
41
- "ts/no-unsafe-argument": "error",
42
- "ts/no-unsafe-assignment": "error",
43
- "ts/no-unsafe-call": "error",
44
- "ts/no-unsafe-member-access": "error",
45
- "ts/no-unsafe-return": "error",
46
- "ts/restrict-plus-operands": "error",
47
- "ts/restrict-template-expressions": "error",
48
- "ts/unbound-method": "error"
49
- };
50
- const [
51
- pluginTs,
52
- parserTs
53
- ] = await Promise.all([
54
- interop(import("@typescript-eslint/eslint-plugin")),
55
- interop(import("@typescript-eslint/parser"))
56
- ]);
57
- function makeParser(typeAware, files2, ignores) {
58
- return {
59
- files: files2,
60
- ...ignores ? { ignores } : {},
61
- name: `luxass:typescript:${typeAware ? "type-aware-parser" : "parser"}`,
62
- languageOptions: {
63
- parser: parserTs,
64
- parserOptions: {
65
- extraFileExtensions: exts.map((ext) => `.${ext}`),
66
- sourceType: "module",
67
- ...typeAware ? {
68
- project: tsconfigPath,
69
- tsconfigRootDir: process.cwd()
70
- } : {},
71
- ...parserOptions
72
- }
73
- }
74
- };
75
- }
76
- return [
77
- {
78
- // Install the plugins without globs, so they can be configured separately.
79
- name: "luxass:typescript:setup",
80
- plugins: {
81
- antfu: pluginAntfu,
82
- ts: pluginTs
83
- }
84
- },
85
- ...isTypeAware ? [
86
- makeParser(true, filesTypeAware),
87
- makeParser(false, files, filesTypeAware)
88
- ] : [makeParser(false, files)],
89
- {
90
- name: "luxass:typescript:rules",
91
- files,
92
- rules: {
93
- ...renameRules(
94
- pluginTs.configs["eslint-recommended"].overrides[0].rules,
95
- "@typescript-eslint/",
96
- "ts/"
97
- ),
98
- ...renameRules(
99
- pluginTs.configs.strict.rules,
100
- "@typescript-eslint/",
101
- "ts/"
102
- ),
103
- "no-dupe-class-members": "off",
104
- "no-invalid-this": "off",
105
- "no-loss-of-precision": "off",
106
- "no-redeclare": "off",
107
- "no-use-before-define": "off",
108
- "no-useless-constructor": "off",
109
- "ts/ban-ts-comment": [
110
- "error",
111
- { "ts-ignore": "allow-with-description" }
112
- ],
113
- "ts/ban-types": ["error", {
114
- extendDefaults: false,
115
- types: {
116
- BigInt: {
117
- fixWith: "bigint",
118
- message: "Use `bigint` instead."
119
- },
120
- Boolean: {
121
- fixWith: "boolean",
122
- message: "Use `boolean` instead."
123
- },
124
- Function: "Use a specific function type instead, like `() => void`.",
125
- Number: {
126
- fixWith: "number",
127
- message: "Use `number` instead."
128
- },
129
- Object: {
130
- fixWith: "Record<string, unknown>",
131
- message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848"
132
- },
133
- String: {
134
- fixWith: "string",
135
- message: "Use `string` instead."
136
- },
137
- Symbol: {
138
- fixWith: "symbol",
139
- message: "Use `symbol` instead."
140
- },
141
- object: {
142
- fixWith: "Record<string, unknown>",
143
- message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848"
144
- }
145
- }
146
- }],
147
- "ts/consistent-type-definitions": ["error", "interface"],
148
- "ts/consistent-type-imports": [
149
- "error",
150
- { disallowTypeAnnotations: false, prefer: "type-imports" }
151
- ],
152
- "ts/no-dupe-class-members": "error",
153
- "ts/no-dynamic-delete": "off",
154
- "ts/no-explicit-any": "off",
155
- "ts/no-extraneous-class": "off",
156
- "ts/no-import-type-side-effects": "error",
157
- "ts/no-invalid-this": "error",
158
- "ts/no-invalid-void-type": "off",
159
- "ts/no-loss-of-precision": "error",
160
- "ts/no-non-null-assertion": "off",
161
- "ts/no-redeclare": "error",
162
- "ts/no-require-imports": "error",
163
- "ts/no-unused-vars": "off",
164
- "ts/no-use-before-define": [
165
- "error",
166
- { classes: false, functions: false, variables: true }
167
- ],
168
- "ts/no-useless-constructor": "off",
169
- "ts/prefer-ts-expect-error": "error",
170
- "ts/triple-slash-reference": "off",
171
- "ts/unified-signatures": "off",
172
- ...overrides
173
- }
174
- },
175
- {
176
- name: "luxass:typescript:rules-type-aware",
177
- files: filesTypeAware,
178
- rules: {
179
- ...tsconfigPath ? typeAwareRules : {},
180
- ...overrides
181
- }
182
- },
183
- {
184
- name: "luxass:typescript:dts-overrides",
185
- files: ["**/*.d.ts"],
186
- rules: {
187
- "eslint-comments/no-unlimited-disable": "off",
188
- "import/no-duplicates": "off",
189
- "no-restricted-syntax": "off",
190
- "unused-imports/no-unused-vars": "off"
191
- }
192
- },
193
- {
194
- name: "luxass:typescript:tests-overrides",
195
- files: ["**/*.{test,spec}.ts?(x)"],
196
- rules: {
197
- "no-unused-expressions": "off"
198
- }
199
- },
200
- {
201
- name: "luxass:typescript:playground-overrides",
202
- files: [`**/playground.${GLOB_SRC_EXT}`],
203
- rules: {
204
- "no-console": "off"
205
- }
206
- },
207
- {
208
- name: "luxass:typescript:javascript-overrides",
209
- files: ["**/*.js", "**/*.cjs"],
210
- rules: {
211
- "ts/no-require-imports": "off",
212
- "ts/no-var-requires": "off"
213
- }
214
- }
215
- ];
216
- }
217
-
218
- export {
219
- typescript
220
- };