@infra-x/create-eslint-config 0.2.1 → 0.2.3
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/dist/template/.turbo/turbo-build.log +5 -5
- package/dist/template/CHANGELOG.md +12 -0
- package/dist/template/README.md +0 -8
- package/dist/template/package.json +2 -2
- package/dist/template/src/configs/better-tailwindcss.ts +11 -1
- package/dist/template/src/configs/imports.ts +1 -3
- package/dist/template/src/configs/react.ts +2 -2
- package/dist/template/src/configs/typescript.ts +1 -1
- package/dist/template/src/index.ts +1 -1
- package/dist/template/src/types.ts +7 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @infra-x/eslint-config@0.1.
|
|
2
|
+
> @infra-x/eslint-config@0.1.10 build /home/runner/work/infra-code/infra-code/packages/eslint-config
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m tsdown [2mv0.21.4[22m powered by rolldown [2mv1.0.0-rc.9[22m
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m16.
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 7.
|
|
12
|
-
[34mℹ[39m 2 files, total:
|
|
13
|
-
[32m✔[39m Build complete in [
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m16.92 kB[22m [2m│ gzip: 4.89 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 7.34 kB[22m [2m│ gzip: 2.42 kB[22m
|
|
12
|
+
[34mℹ[39m 2 files, total: 24.26 kB
|
|
13
|
+
[32m✔[39m Build complete in [32m1774ms[39m
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @infra-x/eslint-config
|
|
2
2
|
|
|
3
|
+
## 0.1.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add `better-tailwindcss/enforce-canonical-classes` rule with rootFontSize 16
|
|
8
|
+
|
|
9
|
+
## 0.1.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4125221: Remove `import-x/no-unused-modules` rule which is a no-op in ESLint 10 due to the removal of the `FileEnumerator` API. Translate remaining Chinese comments to English.
|
|
14
|
+
|
|
3
15
|
## 0.1.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/template/README.md
CHANGED
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"eslint-plugin-package-json": "^0.91.0",
|
|
48
48
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
49
49
|
"eslint-plugin-react-refresh": "^0.5.2",
|
|
50
|
-
"eslint-plugin-oxlint": "^0.
|
|
50
|
+
"eslint-plugin-oxlint": "^0.18.0",
|
|
51
51
|
"eslint-plugin-storybook": "^10.2.14",
|
|
52
52
|
"eslint-plugin-unicorn": "^63.0.0",
|
|
53
53
|
"typescript-eslint": "^8.56.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"eslint": "^
|
|
56
|
+
"eslint": "^10.0.0",
|
|
57
57
|
"globals": "17.4.0",
|
|
58
58
|
"jiti": "2.6.1",
|
|
59
59
|
"storybook": ">=10.0.0",
|
|
@@ -13,7 +13,15 @@ import type { Linter } from 'eslint'
|
|
|
13
13
|
* Tailwind CSS rule configuration
|
|
14
14
|
*/
|
|
15
15
|
export function tailwind(options: TailwindOptions = {}): Linter.Config[] {
|
|
16
|
-
const { files = [GLOB_JSX], overrides = {}, entryPoint = 'src/styles/global.css' } = options
|
|
16
|
+
const { files = [GLOB_JSX], overrides = {}, entryPoint = 'src/styles/global.css', rootFontSize } = options
|
|
17
|
+
|
|
18
|
+
if (rootFontSize === undefined) {
|
|
19
|
+
console.warn(
|
|
20
|
+
'[eslint-config] tailwind: `rootFontSize` is not set. '
|
|
21
|
+
+ 'This affects `enforce-canonical-classes` — set it to your `<html>` font size (usually 16). '
|
|
22
|
+
+ 'Defaulting to 16.',
|
|
23
|
+
)
|
|
24
|
+
}
|
|
17
25
|
|
|
18
26
|
return defineConfig({
|
|
19
27
|
name: 'tailwind/rules',
|
|
@@ -23,11 +31,13 @@ export function tailwind(options: TailwindOptions = {}): Linter.Config[] {
|
|
|
23
31
|
],
|
|
24
32
|
rules: {
|
|
25
33
|
'better-tailwindcss/enforce-consistent-line-wrapping': ['error', { printWidth: 0 }],
|
|
34
|
+
'better-tailwindcss/enforce-canonical-classes': 'error',
|
|
26
35
|
...overrides,
|
|
27
36
|
},
|
|
28
37
|
settings: {
|
|
29
38
|
'better-tailwindcss': {
|
|
30
39
|
entryPoint,
|
|
40
|
+
rootFontSize: rootFontSize ?? 16,
|
|
31
41
|
},
|
|
32
42
|
},
|
|
33
43
|
})
|
|
@@ -78,10 +78,8 @@ export function imports(options: ImportsOptions = {}): Linter.Config[] {
|
|
|
78
78
|
],
|
|
79
79
|
'import-x/consistent-type-specifier-style': 'error',
|
|
80
80
|
'import-x/no-named-as-default': 'warn',
|
|
81
|
-
// maxDepth
|
|
81
|
+
// maxDepth prevents full-graph traversal for performance
|
|
82
82
|
'import-x/no-cycle': ['error', { maxDepth: 5 }],
|
|
83
|
-
// ignoreExports 防止入口文件的导出被误报为未使用
|
|
84
|
-
'import-x/no-unused-modules': ['error', { unusedExports: true, ignoreExports: ['**/index.ts', '**/index.tsx'] }],
|
|
85
83
|
'import-x/no-deprecated': 'warn',
|
|
86
84
|
'import-x/no-extraneous-dependencies': 'error',
|
|
87
85
|
'import-x/no-relative-parent-imports': noRelativeParentImports ? 'error' : 'off',
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import reactPlugin from '@eslint-react/eslint-plugin'
|
|
5
5
|
import { defineConfig } from 'eslint/config'
|
|
6
|
-
// import reactHooksPlugin from 'eslint-plugin-react-hooks'// reactPlugin
|
|
6
|
+
// import reactHooksPlugin from 'eslint-plugin-react-hooks' // reactPlugin already includes reactHooksPlugin in newer versions
|
|
7
7
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
8
8
|
|
|
9
9
|
import { GLOB_JSX } from '../utils'
|
|
@@ -26,7 +26,7 @@ export function react(options: ReactOptions = {}): Linter.Config[] {
|
|
|
26
26
|
...(vite ? [reactRefresh.configs.recommended] : []),
|
|
27
27
|
],
|
|
28
28
|
rules: {
|
|
29
|
-
// attributes: false
|
|
29
|
+
// attributes: false allows passing async functions to JSX event attributes (e.g. onClick), which is valid in React
|
|
30
30
|
'@typescript-eslint/no-misused-promises': [
|
|
31
31
|
'error',
|
|
32
32
|
{
|
|
@@ -34,7 +34,7 @@ export function typescript(options: TypeScriptOptions = {}): Linter.Config[] {
|
|
|
34
34
|
'@typescript-eslint/consistent-type-imports': 'error',
|
|
35
35
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
36
36
|
'@typescript-eslint/no-deprecated': 'warn',
|
|
37
|
-
// '@typescript-eslint/no-inferrable-types': 'off',
|
|
37
|
+
// '@typescript-eslint/no-inferrable-types': 'off', would cause redundant type annotations
|
|
38
38
|
'@typescript-eslint/unbound-method': 'warn',
|
|
39
39
|
|
|
40
40
|
...overrides,
|
|
@@ -25,10 +25,10 @@ import { imports } from './configs/imports'
|
|
|
25
25
|
import { javascript } from './configs/javascript'
|
|
26
26
|
import { jsdoc } from './configs/jsdoc'
|
|
27
27
|
import { nextjs } from './configs/nextjs'
|
|
28
|
+
import { oxlintConfig } from './configs/oxlint'
|
|
28
29
|
import { packageJson } from './configs/package-json'
|
|
29
30
|
import { react } from './configs/react'
|
|
30
31
|
import { storybook } from './configs/storybook'
|
|
31
|
-
import { oxlintConfig } from './configs/oxlint'
|
|
32
32
|
import { stylistic } from './configs/stylistic'
|
|
33
33
|
import { typescript } from './configs/typescript'
|
|
34
34
|
import { unicorn } from './configs/unicorn'
|
|
@@ -38,6 +38,12 @@ export interface OptionsTailwind {
|
|
|
38
38
|
* @default 'src/global.css'
|
|
39
39
|
*/
|
|
40
40
|
entryPoint?: string
|
|
41
|
+
/**
|
|
42
|
+
* Font size of the `<html>` element in pixels.
|
|
43
|
+
* Used by `enforce-canonical-classes` to determine if arbitrary values can be replaced with predefined sizing scales.
|
|
44
|
+
* @default 16
|
|
45
|
+
*/
|
|
46
|
+
rootFontSize?: number
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
// ============================================================================
|
|
@@ -106,7 +112,7 @@ export interface ImportsOptions extends OptionsOverrides {
|
|
|
106
112
|
*/
|
|
107
113
|
noRelativeParentImports?: boolean
|
|
108
114
|
/**
|
|
109
|
-
* Root directory for tsconfig.json lookup; restricts resolver scope in monorepo to avoid cross-app
|
|
115
|
+
* Root directory for tsconfig.json lookup; restricts resolver scope in monorepo to avoid cross-app roaming
|
|
110
116
|
* Automatically injected by composeConfig from the global typescript.tsconfigRootDir option
|
|
111
117
|
*/
|
|
112
118
|
tsconfigRootDir?: string
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infra-x/create-eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"description": "CLI to copy ESLint config source into a monorepo.",
|
|
6
6
|
"author": "infra-x",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"eslint": "^10.0.2",
|
|
30
30
|
"tsdown": "^0.21.0",
|
|
31
31
|
"typescript": "^5.9.3",
|
|
32
|
-
"@infra-x/
|
|
33
|
-
"@infra-x/
|
|
32
|
+
"@infra-x/eslint-config": "0.1.10",
|
|
33
|
+
"@infra-x/typescript-config": "0.1.6"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|
|
36
36
|
".": "./dist/index.mjs",
|