zirka 0.0.25 → 0.0.26
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 +64 -29
- package/dist/styleguide.cjs +8 -1
- package/dist/styleguide.d.cts +1 -0
- package/dist/styleguide.d.ts +1 -0
- package/dist/styleguide.js +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# zirka ⭐
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> зірка — *star* in Ukrainian
|
|
4
|
+
|
|
5
|
+
**zirka** is a shared ESLint, Prettier, and TypeScript config. Configs are loaded lazily — only the plugins you enable are imported. `jiti` is bundled, so TypeScript config files just work.
|
|
6
|
+
|
|
7
|
+
---
|
|
4
8
|
|
|
5
9
|
## Install
|
|
6
10
|
|
|
7
11
|
```sh
|
|
8
|
-
npm i -D
|
|
12
|
+
npm i -D zirka eslint prettier typescript
|
|
9
13
|
```
|
|
10
14
|
|
|
15
|
+
---
|
|
16
|
+
|
|
11
17
|
## Usage
|
|
12
18
|
|
|
13
19
|
### ESLint — `eslint.config.ts`
|
|
14
20
|
|
|
15
21
|
```ts
|
|
16
|
-
import {
|
|
22
|
+
import { RuleSeverity, styleguide } from "zirka";
|
|
17
23
|
|
|
18
24
|
const { eslintConfig } = styleguide({
|
|
19
25
|
browser: RuleSeverity.Error,
|
|
20
26
|
typescript: RuleSeverity.Error,
|
|
21
|
-
react: RuleSeverity.
|
|
22
|
-
next: RuleSeverity.
|
|
27
|
+
react: RuleSeverity.Error,
|
|
28
|
+
next: RuleSeverity.Error,
|
|
23
29
|
node: RuleSeverity.Off,
|
|
24
|
-
playwright: RuleSeverity.
|
|
30
|
+
playwright: RuleSeverity.Error,
|
|
31
|
+
ignores: [".next/**", "node_modules/**"],
|
|
25
32
|
});
|
|
26
33
|
|
|
27
34
|
export default eslintConfig;
|
|
@@ -30,10 +37,10 @@ export default eslintConfig;
|
|
|
30
37
|
### Prettier — `prettier.config.js`
|
|
31
38
|
|
|
32
39
|
```js
|
|
33
|
-
import { styleguide } from
|
|
40
|
+
import { styleguide } from "zirka";
|
|
34
41
|
|
|
35
42
|
const { prettierConfig } = styleguide({
|
|
36
|
-
prettier:
|
|
43
|
+
prettier: { tailwind: true }, // or just `true`
|
|
37
44
|
});
|
|
38
45
|
|
|
39
46
|
export default prettierConfig;
|
|
@@ -43,34 +50,62 @@ export default prettierConfig;
|
|
|
43
50
|
|
|
44
51
|
```json
|
|
45
52
|
{
|
|
46
|
-
"extends": "
|
|
53
|
+
"extends": "zirka/typescript"
|
|
47
54
|
}
|
|
48
55
|
```
|
|
49
56
|
|
|
57
|
+
---
|
|
58
|
+
|
|
50
59
|
## Options
|
|
51
60
|
|
|
52
|
-
| Option
|
|
53
|
-
|
|
|
54
|
-
| `browser`
|
|
55
|
-
| `node`
|
|
56
|
-
| `typescript`
|
|
57
|
-
| `react`
|
|
58
|
-
| `next`
|
|
59
|
-
| `playwright`
|
|
60
|
-
| `ignores`
|
|
61
|
-
| `additionalConfigs
|
|
62
|
-
| `prettier`
|
|
61
|
+
| Option | Type | Description |
|
|
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 |
|
|
72
|
+
| `tsconfigPath` | `string` | Custom tsconfig path for type-checking |
|
|
63
73
|
|
|
64
74
|
### `RuleSeverity`
|
|
65
75
|
|
|
66
|
-
| Value | Behaviour
|
|
67
|
-
| ----------- |
|
|
68
|
-
| `"error"` | All rules set to `error`
|
|
69
|
-
| `"warn"` | All rules set to `warn`
|
|
70
|
-
| `"default"` | Rules use their recommended severity as-is
|
|
71
|
-
| `"off"` | Config block skipped entirely (no import)
|
|
76
|
+
| Value | Behaviour |
|
|
77
|
+
| ----------- | ------------------------------------------ |
|
|
78
|
+
| `"error"` | All rules set to `error` |
|
|
79
|
+
| `"warn"` | All rules set to `warn` |
|
|
80
|
+
| `"default"` | Rules use their recommended severity as-is |
|
|
81
|
+
| `"off"` | Config block skipped entirely (no import) |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Custom tsconfig
|
|
86
|
+
|
|
87
|
+
If your `eslint.config.ts` lives outside `src/` and you have `rootDir: src` in your tsconfig, point zirka at a separate tsconfig that includes root-level files:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
// eslint.config.ts
|
|
91
|
+
const { eslintConfig } = styleguide({
|
|
92
|
+
typescript: RuleSeverity.Error,
|
|
93
|
+
tsconfigPath: "./tsconfig.eslint.json",
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
// tsconfig.eslint.json
|
|
99
|
+
{
|
|
100
|
+
"extends": "./tsconfig.json",
|
|
101
|
+
"compilerOptions": { "noEmit": true, "rootDir": "." },
|
|
102
|
+
"include": ["src/**/*.ts", "eslint.config.ts"]
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
72
107
|
|
|
73
108
|
## Requirements
|
|
74
109
|
|
|
75
|
-
- Node ≥ 22
|
|
76
|
-
- eslint ^9 · prettier ^3 · typescript ^5 (peer deps)
|
|
110
|
+
- Node ≥ 22
|
|
111
|
+
- `eslint` ^9 · `prettier` ^3 · `typescript` ^5 (peer deps)
|
package/dist/styleguide.cjs
CHANGED
|
@@ -1286,7 +1286,7 @@ var init_styleguide = __esm({
|
|
|
1286
1286
|
return transformSeverity2(config, severity);
|
|
1287
1287
|
};
|
|
1288
1288
|
loadEslintConfigs = async (options) => {
|
|
1289
|
-
const { browser, node, typescript, react: react2, next, playwright, ignores, additionalConfigs = [] } = options;
|
|
1289
|
+
const { browser, node, typescript, react: react2, next, playwright, ignores, additionalConfigs = [], tsconfigPath } = options;
|
|
1290
1290
|
const configLoaders = [
|
|
1291
1291
|
{ loader: () => Promise.resolve().then(() => (init_browser(), browser_exports)).then((m) => m.browserConfig), severity: browser },
|
|
1292
1292
|
{ loader: () => Promise.resolve().then(() => (init_node(), node_exports)).then((m) => m.nodeConfig), severity: node },
|
|
@@ -1303,6 +1303,13 @@ var init_styleguide = __esm({
|
|
|
1303
1303
|
eslintConfigs.push(...processedConfig);
|
|
1304
1304
|
}
|
|
1305
1305
|
}
|
|
1306
|
+
if (tsconfigPath) {
|
|
1307
|
+
eslintConfigs.push({
|
|
1308
|
+
languageOptions: {
|
|
1309
|
+
parserOptions: { project: tsconfigPath }
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1306
1313
|
if (ignores && ignores.length > 0) {
|
|
1307
1314
|
eslintConfigs.push({ ignores });
|
|
1308
1315
|
}
|
package/dist/styleguide.d.cts
CHANGED
package/dist/styleguide.d.ts
CHANGED
package/dist/styleguide.js
CHANGED
|
@@ -1264,7 +1264,7 @@ var init_styleguide = __esm({
|
|
|
1264
1264
|
return transformSeverity2(config, severity);
|
|
1265
1265
|
};
|
|
1266
1266
|
loadEslintConfigs = async (options) => {
|
|
1267
|
-
const { browser, node, typescript, react: react2, next, playwright, ignores, additionalConfigs = [] } = options;
|
|
1267
|
+
const { browser, node, typescript, react: react2, next, playwright, ignores, additionalConfigs = [], tsconfigPath } = options;
|
|
1268
1268
|
const configLoaders = [
|
|
1269
1269
|
{ loader: () => Promise.resolve().then(() => (init_browser(), browser_exports)).then((m) => m.browserConfig), severity: browser },
|
|
1270
1270
|
{ loader: () => Promise.resolve().then(() => (init_node(), node_exports)).then((m) => m.nodeConfig), severity: node },
|
|
@@ -1281,6 +1281,13 @@ var init_styleguide = __esm({
|
|
|
1281
1281
|
eslintConfigs.push(...processedConfig);
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
1284
|
+
if (tsconfigPath) {
|
|
1285
|
+
eslintConfigs.push({
|
|
1286
|
+
languageOptions: {
|
|
1287
|
+
parserOptions: { project: tsconfigPath }
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1284
1291
|
if (ignores && ignores.length > 0) {
|
|
1285
1292
|
eslintConfigs.push({ ignores });
|
|
1286
1293
|
}
|