zirka 0.0.27 → 0.0.28
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 +80 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> зірка — _star_ in Ukrainian
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Shared ESLint, Prettier, and TypeScript config. Only the plugins you enable are imported — unused configs add zero overhead. `jiti` is bundled so TypeScript config files work out of the box.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -14,70 +14,114 @@ npm i -D zirka eslint prettier typescript
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
### ESLint — `eslint.config.ts`
|
|
17
|
+
## ESLint — `eslint.config.ts`
|
|
20
18
|
|
|
21
19
|
```ts
|
|
22
20
|
import { RuleSeverity, styleguide } from "zirka";
|
|
23
21
|
|
|
24
22
|
const { eslintConfig } = styleguide({
|
|
25
|
-
|
|
23
|
+
node: RuleSeverity.Error,
|
|
26
24
|
typescript: RuleSeverity.Error,
|
|
27
|
-
|
|
28
|
-
next: RuleSeverity.Error,
|
|
29
|
-
node: RuleSeverity.Off,
|
|
30
|
-
playwright: RuleSeverity.Error,
|
|
31
|
-
ignores: [".next/**", "node_modules/**"],
|
|
25
|
+
ignores: ["dist/**", "node_modules/**"],
|
|
32
26
|
});
|
|
33
27
|
|
|
34
28
|
export default eslintConfig;
|
|
35
29
|
```
|
|
36
30
|
|
|
37
|
-
|
|
31
|
+
Each config block is loaded lazily — if you don't enable `react`, none of its plugins are imported.
|
|
32
|
+
|
|
33
|
+
### What's included per block
|
|
34
|
+
|
|
35
|
+
| Block | Globals | Rules |
|
|
36
|
+
| ------------ | -------------------------- | -------------------------------------------------- |
|
|
37
|
+
| `browser` | `window`, `document`, etc. | Base JS + import + prettier + unicorn |
|
|
38
|
+
| `node` | `process`, `Buffer`, etc. | Base JS + import + prettier + unicorn |
|
|
39
|
+
| `typescript` | — | `typescript-eslint` strict + stylistic, type-aware |
|
|
40
|
+
| `react` | — | `@eslint-react`, `react-hooks`, `jsx-a11y` |
|
|
41
|
+
| `next` | — | `@next/eslint-plugin-next` |
|
|
42
|
+
| `playwright` | — | `eslint-plugin-playwright` |
|
|
43
|
+
|
|
44
|
+
Base rules (always included with any block): `@eslint/js` recommended, `eslint-plugin-import`, `eslint-plugin-prettier`, `eslint-plugin-unicorn`, `eslint-comments`.
|
|
45
|
+
|
|
46
|
+
### `RuleSeverity`
|
|
47
|
+
|
|
48
|
+
| Value | Behaviour |
|
|
49
|
+
| ----------- | ------------------------------------------------ |
|
|
50
|
+
| `"error"` | All rules set to `error` |
|
|
51
|
+
| `"warn"` | All rules set to `warn` |
|
|
52
|
+
| `"default"` | Rules use their recommended severity as-is |
|
|
53
|
+
| `"off"` | Config block skipped entirely — nothing imported |
|
|
54
|
+
|
|
55
|
+
### Options
|
|
56
|
+
|
|
57
|
+
| Option | Type | Description |
|
|
58
|
+
| ------------------- | -------------------------------- | --------------------------------------- |
|
|
59
|
+
| `browser` | `RuleSeverity` | Browser globals |
|
|
60
|
+
| `node` | `RuleSeverity` | Node.js globals |
|
|
61
|
+
| `typescript` | `RuleSeverity` | TypeScript-ESLint strict rules |
|
|
62
|
+
| `react` | `RuleSeverity` | React + JSX-a11y rules |
|
|
63
|
+
| `next` | `RuleSeverity` | Next.js rules |
|
|
64
|
+
| `playwright` | `RuleSeverity` | Playwright test rules |
|
|
65
|
+
| `ignores` | `string[]` | Glob patterns to ignore |
|
|
66
|
+
| `additionalConfigs` | `Linter.Config[]` | Extra flat config entries appended last |
|
|
67
|
+
| `prettier` | `true \| { tailwind?: boolean }` | Enable Prettier config |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Prettier — `prettier.config.js`
|
|
38
72
|
|
|
39
73
|
```js
|
|
40
74
|
import { styleguide } from "zirka";
|
|
41
75
|
|
|
42
76
|
const { prettierConfig } = styleguide({
|
|
43
|
-
prettier:
|
|
77
|
+
prettier: true,
|
|
44
78
|
});
|
|
45
79
|
|
|
46
80
|
export default prettierConfig;
|
|
47
81
|
```
|
|
48
82
|
|
|
49
|
-
|
|
83
|
+
With Tailwind class sorting:
|
|
50
84
|
|
|
51
|
-
```
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
}
|
|
85
|
+
```js
|
|
86
|
+
const { prettierConfig } = styleguide({
|
|
87
|
+
prettier: { tailwind: true },
|
|
88
|
+
});
|
|
55
89
|
```
|
|
56
90
|
|
|
91
|
+
Includes `prettier-plugin-packagejson` by default.
|
|
92
|
+
|
|
57
93
|
---
|
|
58
94
|
|
|
59
|
-
##
|
|
95
|
+
## TypeScript — `tsconfig.json`
|
|
60
96
|
|
|
61
|
-
|
|
62
|
-
| ------------------- | -------------------------------- | ------------------------------- |
|
|
63
|
-
| `browser` | `RuleSeverity` | Browser globals + base JS rules |
|
|
64
|
-
| `node` | `RuleSeverity` | Node.js globals |
|
|
65
|
-
| `typescript` | `RuleSeverity` | TypeScript-ESLint strict rules |
|
|
66
|
-
| `react` | `RuleSeverity` | React + JSX-a11y rules |
|
|
67
|
-
| `next` | `RuleSeverity` | Next.js rules |
|
|
68
|
-
| `playwright` | `RuleSeverity` | Playwright test rules |
|
|
69
|
-
| `ignores` | `string[]` | Glob patterns to ignore |
|
|
70
|
-
| `additionalConfigs` | `Linter.Config[]` | Extra flat config entries |
|
|
71
|
-
| `prettier` | `true \| { tailwind?: boolean }` | Enable Prettier config |
|
|
97
|
+
The base config only sets strictness flags — no environment-specific settings. Extend it and add your own `module`, `lib`, `target`, etc.:
|
|
72
98
|
|
|
73
|
-
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"extends": "zirka/typescript",
|
|
102
|
+
"compilerOptions": {
|
|
103
|
+
"module": "NodeNext",
|
|
104
|
+
"moduleResolution": "NodeNext",
|
|
105
|
+
"noEmit": true
|
|
106
|
+
},
|
|
107
|
+
"include": ["**/*.ts"],
|
|
108
|
+
"exclude": ["node_modules", "dist"]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### What's in the base
|
|
74
113
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"strict": true,
|
|
117
|
+
"esModuleInterop": true,
|
|
118
|
+
"skipLibCheck": true,
|
|
119
|
+
"forceConsistentCasingInFileNames": true,
|
|
120
|
+
"noFallthroughCasesInSwitch": true,
|
|
121
|
+
"noUncheckedIndexedAccess": true,
|
|
122
|
+
"resolveJsonModule": true
|
|
123
|
+
}
|
|
124
|
+
```
|
|
81
125
|
|
|
82
126
|
---
|
|
83
127
|
|