zirka 0.0.26 → 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 CHANGED
@@ -1,8 +1,8 @@
1
1
  # zirka ⭐
2
2
 
3
- > зірка — *star* in Ukrainian
3
+ > зірка — _star_ in Ukrainian
4
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.
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,92 +14,112 @@ npm i -D zirka eslint prettier typescript
14
14
 
15
15
  ---
16
16
 
17
- ## Usage
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
- browser: RuleSeverity.Error,
23
+ node: RuleSeverity.Error,
26
24
  typescript: RuleSeverity.Error,
27
- react: RuleSeverity.Error,
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
- ### Prettier — `prettier.config.js`
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: { tailwind: true }, // or just `true`
77
+ prettier: true,
44
78
  });
45
79
 
46
80
  export default prettierConfig;
47
81
  ```
48
82
 
49
- ### TypeScript `tsconfig.json`
83
+ With Tailwind class sorting:
50
84
 
51
- ```json
52
- {
53
- "extends": "zirka/typescript"
54
- }
85
+ ```js
86
+ const { prettierConfig } = styleguide({
87
+ prettier: { tailwind: true },
88
+ });
55
89
  ```
56
90
 
57
- ---
58
-
59
- ## Options
60
-
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 |
73
-
74
- ### `RuleSeverity`
75
-
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) |
91
+ Includes `prettier-plugin-packagejson` by default.
82
92
 
83
93
  ---
84
94
 
85
- ## Custom tsconfig
95
+ ## TypeScript — `tsconfig.json`
86
96
 
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:
97
+ The base config only sets strictness flags no environment-specific settings. Extend it and add your own `module`, `lib`, `target`, etc.:
88
98
 
89
- ```ts
90
- // eslint.config.ts
91
- const { eslintConfig } = styleguide({
92
- typescript: RuleSeverity.Error,
93
- tsconfigPath: "./tsconfig.eslint.json",
94
- });
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
+ }
95
110
  ```
96
111
 
112
+ ### What's in the base
113
+
97
114
  ```json
98
- // tsconfig.eslint.json
99
115
  {
100
- "extends": "./tsconfig.json",
101
- "compilerOptions": { "noEmit": true, "rootDir": "." },
102
- "include": ["src/**/*.ts", "eslint.config.ts"]
116
+ "strict": true,
117
+ "esModuleInterop": true,
118
+ "skipLibCheck": true,
119
+ "forceConsistentCasingInFileNames": true,
120
+ "noFallthroughCasesInSwitch": true,
121
+ "noUncheckedIndexedAccess": true,
122
+ "resolveJsonModule": true
103
123
  }
104
124
  ```
105
125
 
@@ -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 = [], tsconfigPath } = options;
1289
+ const { browser, node, typescript, react: react2, next, playwright, ignores, additionalConfigs = [] } = 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,13 +1303,6 @@ 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
- }
1313
1306
  if (ignores && ignores.length > 0) {
1314
1307
  eslintConfigs.push({ ignores });
1315
1308
  }
@@ -20,7 +20,6 @@ interface StyleguideOptions {
20
20
  ignores?: string[];
21
21
  additionalConfigs?: Linter.Config[];
22
22
  prettier?: PrettierOptions | true;
23
- tsconfigPath?: string;
24
23
  }
25
24
  interface StyleguideResult {
26
25
  eslintConfig?: Linter.Config[] | Promise<Linter.Config[]>;
@@ -20,7 +20,6 @@ interface StyleguideOptions {
20
20
  ignores?: string[];
21
21
  additionalConfigs?: Linter.Config[];
22
22
  prettier?: PrettierOptions | true;
23
- tsconfigPath?: string;
24
23
  }
25
24
  interface StyleguideResult {
26
25
  eslintConfig?: Linter.Config[] | Promise<Linter.Config[]>;
@@ -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 = [], tsconfigPath } = options;
1267
+ const { browser, node, typescript, react: react2, next, playwright, ignores, additionalConfigs = [] } = 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,13 +1281,6 @@ 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
- }
1291
1284
  if (ignores && ignores.length > 0) {
1292
1285
  eslintConfigs.push({ ignores });
1293
1286
  }
package/package.json CHANGED
@@ -1,70 +1,70 @@
1
- {
2
- "name": "zirka",
3
- "version": "0.0.26",
4
- "description": "",
5
- "license": "ISC",
6
- "author": "",
7
- "type": "module",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/styleguide.js",
11
- "require": "./dist/styleguide.cjs"
12
- },
13
- "./typescript": "./typescript/base.json"
14
- },
15
- "types": "dist/styleguide.d.ts",
16
- "files": [
17
- "dist",
18
- "typescript",
19
- "types"
20
- ],
21
- "scripts": {
22
- "build": "tsup",
23
- "check": "npm run fix && npm run typecheck",
24
- "fix": "eslint . --fix",
25
- "prepare": "husky"
26
- },
27
- "lint-staged": {
28
- "!(*.ts|*.mts|*.cts|*.tsx|*.js|*.cjs|*.mjs|*.jsx)": "prettier --write --ignore-unknown",
29
- "*.ts|*.mts|*.cts|*.tsx|*.js|*.cjs|*.mjs|*.jsx": "eslint --fix"
30
- },
31
- "dependencies": {
32
- "@babel/eslint-parser": "^7.27.1",
33
- "@babel/preset-env": "^7.27.2",
34
- "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
35
- "@eslint-react/eslint-plugin": "^1.53.0",
36
- "@eslint/js": "^9.27.0",
37
- "@next/eslint-plugin-next": "^15.3.3",
38
- "@types/eslint-plugin-jsx-a11y": "^6.10.0",
39
- "@types/node": "^22.15.29",
40
- "eslint-config-prettier": "^10.1.5",
41
- "eslint-import-resolver-typescript": "^4.4.4",
42
- "eslint-plugin-import": "^2.31.0",
43
- "eslint-plugin-jsx-a11y": "^6.10.2",
44
- "eslint-plugin-playwright": "^2.3.0",
45
- "eslint-plugin-prettier": "^5.4.0",
46
- "eslint-plugin-react-hooks": "^5.2.0",
47
- "eslint-plugin-unicorn": "^59.0.1",
48
- "globals": "^16.2.0",
49
- "prettier-plugin-packagejson": "^2.5.14",
50
- "jiti": "^2.6.1",
51
- "prettier-plugin-tailwindcss": "^0.6.14",
52
- "typescript-eslint": "^8.33.1"
53
- },
54
- "devDependencies": {
55
- "eslint": "^9.27.0",
56
- "husky": "^9.1.7",
57
- "lint-staged": "^16.1.6",
58
- "prettier": "^3.5.3",
59
- "tsup": "^8.5.0",
60
- "typescript": "^5.8.3"
61
- },
62
- "peerDependencies": {
63
- "eslint": "^9.27.0",
64
- "prettier": "^3.5.3",
65
- "typescript": "^5.8.3"
66
- },
67
- "engines": {
68
- "node": ">=22.16"
69
- }
70
- }
1
+ {
2
+ "name": "zirka",
3
+ "version": "0.0.28",
4
+ "description": "",
5
+ "license": "ISC",
6
+ "author": "",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/styleguide.js",
11
+ "require": "./dist/styleguide.cjs"
12
+ },
13
+ "./typescript": "./typescript/base.json"
14
+ },
15
+ "types": "dist/styleguide.d.ts",
16
+ "files": [
17
+ "dist",
18
+ "typescript",
19
+ "types"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsup",
23
+ "check": "npm run fix && npm run typecheck",
24
+ "fix": "eslint . --fix",
25
+ "prepare": "husky"
26
+ },
27
+ "lint-staged": {
28
+ "!(*.ts|*.mts|*.cts|*.tsx|*.js|*.cjs|*.mjs|*.jsx)": "prettier --write --ignore-unknown",
29
+ "*.ts|*.mts|*.cts|*.tsx|*.js|*.cjs|*.mjs|*.jsx": "npx eslint --fix"
30
+ },
31
+ "dependencies": {
32
+ "@babel/eslint-parser": "^7.27.1",
33
+ "@babel/preset-env": "^7.27.2",
34
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
35
+ "@eslint-react/eslint-plugin": "^1.53.0",
36
+ "@eslint/js": "^9.27.0",
37
+ "@next/eslint-plugin-next": "^15.3.3",
38
+ "@types/eslint-plugin-jsx-a11y": "^6.10.0",
39
+ "@types/node": "^22.15.29",
40
+ "eslint-config-prettier": "^10.1.5",
41
+ "eslint-import-resolver-typescript": "^4.4.4",
42
+ "eslint-plugin-import": "^2.31.0",
43
+ "eslint-plugin-jsx-a11y": "^6.10.2",
44
+ "eslint-plugin-playwright": "^2.3.0",
45
+ "eslint-plugin-prettier": "^5.4.0",
46
+ "eslint-plugin-react-hooks": "^5.2.0",
47
+ "eslint-plugin-unicorn": "^59.0.1",
48
+ "globals": "^16.2.0",
49
+ "jiti": "^2.6.1",
50
+ "prettier-plugin-packagejson": "^2.5.14",
51
+ "prettier-plugin-tailwindcss": "^0.6.14",
52
+ "typescript-eslint": "^8.33.1"
53
+ },
54
+ "devDependencies": {
55
+ "eslint": "^9.27.0",
56
+ "husky": "^9.1.7",
57
+ "lint-staged": "^16.1.6",
58
+ "prettier": "^3.5.3",
59
+ "tsup": "^8.5.0",
60
+ "typescript": "^5.8.3"
61
+ },
62
+ "peerDependencies": {
63
+ "eslint": "^9.27.0",
64
+ "prettier": "^3.5.3",
65
+ "typescript": "^5.8.3"
66
+ },
67
+ "engines": {
68
+ "node": ">=22.16"
69
+ }
70
+ }
@@ -1,18 +1,12 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "compilerOptions": {
4
- "esModuleInterop": true,
5
- "forceConsistentCasingInFileNames": true,
6
- "noFallthroughCasesInSwitch": true,
7
- "noUncheckedIndexedAccess": true,
8
- "skipLibCheck": true,
9
- "strict": true,
10
- "lib": ["ESNext"],
11
- "module": "es2022",
12
- "target": "esnext",
13
- "moduleResolution": "bundler",
14
- "noEmit": true,
15
- "typeRoots": ["../types", "../node_modules/@types"],
16
- "resolveJsonModule": true
17
- }
18
- }
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "strict": true,
5
+ "esModuleInterop": true,
6
+ "skipLibCheck": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "noFallthroughCasesInSwitch": true,
9
+ "noUncheckedIndexedAccess": true,
10
+ "resolveJsonModule": true
11
+ }
12
+ }