zirka 0.0.45 → 0.0.47
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 +25 -24
- package/dist/styleguide.cjs +25 -62
- package/dist/styleguide.d.cts +2 -1
- package/dist/styleguide.d.ts +2 -1
- package/dist/styleguide.js +25 -62
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,21 +32,21 @@ Each config block is loaded lazily — if you don't enable `react`, none of its
|
|
|
32
32
|
|
|
33
33
|
### What's included per block
|
|
34
34
|
|
|
35
|
-
| Block
|
|
36
|
-
|
|
|
37
|
-
| `browser`
|
|
38
|
-
| `node`
|
|
39
|
-
| `typescript`
|
|
40
|
-
| `react`
|
|
41
|
-
| `next`
|
|
42
|
-
| `playwright`
|
|
43
|
-
| `
|
|
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` | | `pasikaTypescriptApp` | — | Pasika rules for a plain TypeScript repository |
|
|
43
|
+
| `pasikaNextjsApp` | — | Pasika rules for a Next.js application |
|
|
44
44
|
|
|
45
45
|
Base rules (always included with any block): `@eslint/js` recommended, `@eslint-community/eslint-plugin-eslint-comments`, `eslint-plugin-unicorn`, and the hand-written best-practice, ES6, possible-errors, stylistic, and variables rule sets.
|
|
46
46
|
|
|
47
|
-
### The
|
|
47
|
+
### The pasika presets (`pasikaTypescriptApp` / `pasikaNextjsApp`)
|
|
48
48
|
|
|
49
|
-
Enabling
|
|
49
|
+
Enabling a pasika preset wires four language-scoped rule sets (see the pasika README for the full rule tables):
|
|
50
50
|
|
|
51
51
|
| Files | Rules |
|
|
52
52
|
| ------------------------------------------ | ------------------------- |
|
|
@@ -55,7 +55,7 @@ Enabling `pasika` wires four language-scoped rule sets (see the pasika README fo
|
|
|
55
55
|
| `**/*.md` (not `_templates/`) | `pasika/*` Markdown rules |
|
|
56
56
|
| `package.json` | `pasika/*` JSON rules |
|
|
57
57
|
|
|
58
|
-
The JS/TS base blocks (browser, node, typescript, react, next, playwright) are scoped to JS/TS files, so the pasika language blocks are never shadowed — CSS, Markdown, and JSON files are linted by their own rules.
|
|
58
|
+
`typescriptApp` is the plain-TypeScript-repository preset — the package.json manifest, the zirka configuration contract, the `src/**` TypeScript app source, and the docs. `nextjsApp` is everything in `typescriptApp` plus the Next.js-stack manifest requirement, the Next.js app source rules, and the Tailwind stylesheet rules. The JS/TS base blocks (browser, node, typescript, react, next, playwright) are scoped to JS/TS files, so the pasika language blocks are never shadowed — CSS, Markdown, and JSON files are linted by their own rules.
|
|
59
59
|
|
|
60
60
|
### `RuleSeverity`
|
|
61
61
|
|
|
@@ -68,18 +68,19 @@ The JS/TS base blocks (browser, node, typescript, react, next, playwright) are s
|
|
|
68
68
|
|
|
69
69
|
### Options
|
|
70
70
|
|
|
71
|
-
| Option
|
|
72
|
-
|
|
|
73
|
-
| `browser`
|
|
74
|
-
| `node`
|
|
75
|
-
| `typescript`
|
|
76
|
-
| `react`
|
|
77
|
-
| `next`
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
71
|
+
| Option | Type | Description |
|
|
72
|
+
| --------------------- | -------------------------------- | ---------------------------------------------- |
|
|
73
|
+
| `browser` | `RuleSeverity` | Browser globals |
|
|
74
|
+
| `node` | `RuleSeverity` | Node.js globals |
|
|
75
|
+
| `typescript` | `RuleSeverity` | TypeScript-ESLint strict rules |
|
|
76
|
+
| `react` | `RuleSeverity` | React + JSX-a11y rules |
|
|
77
|
+
| `next` | `RuleSeverity` | Next.js rules |
|
|
78
|
+
| `pasikaTypescriptApp` | `RuleSeverity` | Pasika rules for a plain TypeScript repository |
|
|
79
|
+
| `pasikaNextjsApp` | `RuleSeverity` | Pasika rules for a Next.js application |
|
|
80
|
+
| `playwright` | `RuleSeverity` | Playwright test rules |
|
|
81
|
+
| `ignores` | `string[]` | Glob patterns to ignore |
|
|
82
|
+
| `additionalConfigs` | `Linter.Config[]` | Extra flat config entries appended last |
|
|
83
|
+
| `prettier` | `true \| { tailwind?: boolean }` | Enable Prettier config |
|
|
83
84
|
|
|
84
85
|
---
|
|
85
86
|
|
package/dist/styleguide.cjs
CHANGED
|
@@ -1086,8 +1086,8 @@ __export(styleguide_exports, {
|
|
|
1086
1086
|
});
|
|
1087
1087
|
module.exports = __toCommonJS(styleguide_exports);
|
|
1088
1088
|
function styleguide(options) {
|
|
1089
|
-
const { browser, node, typescript, react: react2, next,
|
|
1090
|
-
const hasEslintOptions = browser ?? node ?? typescript ?? react2 ?? next ??
|
|
1089
|
+
const { browser, node, typescript, react: react2, next, pasikaTypescriptApp, pasikaNextjsApp, playwright, prettier } = options;
|
|
1090
|
+
const hasEslintOptions = browser ?? node ?? typescript ?? react2 ?? next ?? pasikaTypescriptApp ?? pasikaNextjsApp ?? playwright;
|
|
1091
1091
|
const prettierConfig = prettier ? getPrettierConfig(prettier) : void 0;
|
|
1092
1092
|
if (!hasEslintOptions) {
|
|
1093
1093
|
return { prettierConfig };
|
|
@@ -1118,75 +1118,38 @@ var init_styleguide = __esm({
|
|
|
1118
1118
|
};
|
|
1119
1119
|
JS_TS_FILES = [...JAVASCRIPT_FILES, ...TYPESCRIPT_FILES];
|
|
1120
1120
|
scopeToJsTs = (configs) => configs.map((config) => config.files ? config : { files: JS_TS_FILES, ...config });
|
|
1121
|
-
loadPasikaConfigs = async () => {
|
|
1122
|
-
const
|
|
1123
|
-
import("pasika/eslint"),
|
|
1124
|
-
import("@eslint/css"),
|
|
1125
|
-
import("@eslint/json"),
|
|
1126
|
-
import("@eslint/markdown")
|
|
1127
|
-
]);
|
|
1128
|
-
const cssPlugin = cssMod.default;
|
|
1129
|
-
const jsonPlugin = jsonMod.default;
|
|
1130
|
-
const markdownPlugin = markdownMod.default;
|
|
1121
|
+
loadPasikaConfigs = async (preset) => {
|
|
1122
|
+
const pasika = await import("pasika/eslint");
|
|
1131
1123
|
const pasikaJsTs = { rules: pasika.pasikaRules };
|
|
1132
|
-
const
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1135
|
-
{
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
},
|
|
1140
|
-
// All JS/TS files, so source-under-src can flag modules outside src/ that
|
|
1141
|
-
// the src-scoped block above never sees (config files are exempt in-rule).
|
|
1142
|
-
{
|
|
1143
|
-
files: JS_TS_FILES,
|
|
1144
|
-
plugins: { pasika: pasikaJsTs },
|
|
1145
|
-
rules: { "pasika/source-under-src": "error" }
|
|
1146
|
-
},
|
|
1147
|
-
{
|
|
1148
|
-
files: ["src/**/globals.css"],
|
|
1149
|
-
plugins: { css: cssPlugin, pasika: pasikaCss },
|
|
1150
|
-
language: "css/css",
|
|
1151
|
-
languageOptions: { tolerant: true },
|
|
1152
|
-
rules: Object.fromEntries(
|
|
1153
|
-
Object.keys(pasika.cssRules).filter((name) => name !== "global-css-location").map((name) => [`pasika/${name}`, "error"])
|
|
1154
|
-
)
|
|
1155
|
-
},
|
|
1156
|
-
{
|
|
1157
|
-
files: ["src/**/*.css"],
|
|
1158
|
-
plugins: { css: cssPlugin, pasika: pasikaCss },
|
|
1159
|
-
language: "css/css",
|
|
1160
|
-
languageOptions: { tolerant: true },
|
|
1161
|
-
rules: { "pasika/global-css-location": "error" }
|
|
1162
|
-
},
|
|
1163
|
-
{
|
|
1164
|
-
files: ["**/*.md"],
|
|
1165
|
-
ignores: ["**/_templates/**"],
|
|
1166
|
-
plugins: { markdown: markdownPlugin, pasika: { rules: pasika.mdRules } },
|
|
1167
|
-
language: "markdown/gfm",
|
|
1168
|
-
rules: Object.fromEntries(Object.keys(pasika.mdRules).map((name) => [`pasika/${name}`, "error"]))
|
|
1169
|
-
},
|
|
1170
|
-
{
|
|
1171
|
-
files: ["package.json"],
|
|
1172
|
-
plugins: {
|
|
1173
|
-
json: { languages: { json: jsonPlugin.languages.json } },
|
|
1174
|
-
pasika: pasikaJson
|
|
1175
|
-
},
|
|
1176
|
-
language: "json/json",
|
|
1177
|
-
rules: Object.fromEntries(Object.keys(pasika.jsonRules).map((name) => [`pasika/${name}`, "error"]))
|
|
1178
|
-
}
|
|
1179
|
-
];
|
|
1124
|
+
const app = pasika[preset];
|
|
1125
|
+
const sourceUnderSrc = {
|
|
1126
|
+
files: JS_TS_FILES,
|
|
1127
|
+
plugins: { pasika: pasikaJsTs },
|
|
1128
|
+
rules: { "pasika/source-under-src": "error" }
|
|
1129
|
+
};
|
|
1130
|
+
return [...app, sourceUnderSrc];
|
|
1180
1131
|
};
|
|
1181
1132
|
loadEslintConfigs = async (options) => {
|
|
1182
|
-
const {
|
|
1133
|
+
const {
|
|
1134
|
+
browser,
|
|
1135
|
+
node,
|
|
1136
|
+
typescript,
|
|
1137
|
+
react: react2,
|
|
1138
|
+
next,
|
|
1139
|
+
pasikaTypescriptApp,
|
|
1140
|
+
pasikaNextjsApp,
|
|
1141
|
+
playwright,
|
|
1142
|
+
ignores,
|
|
1143
|
+
additionalConfigs = []
|
|
1144
|
+
} = options;
|
|
1183
1145
|
const configLoaders = [
|
|
1184
1146
|
{ loader: () => Promise.resolve().then(() => (init_browser(), browser_exports)).then((m) => m.browserConfig), severity: browser },
|
|
1185
1147
|
{ loader: () => Promise.resolve().then(() => (init_node(), node_exports)).then((m) => m.nodeConfig), severity: node },
|
|
1186
1148
|
{ loader: () => Promise.resolve().then(() => (init_typescript2(), typescript_exports)).then((m) => m.typescriptConfig), severity: typescript },
|
|
1187
1149
|
{ loader: () => Promise.resolve().then(() => (init_react(), react_exports)).then((m) => m.reactConfig), severity: react2 },
|
|
1188
1150
|
{ loader: () => Promise.resolve().then(() => (init_next(), next_exports)).then((m) => m.nextConfig), severity: next },
|
|
1189
|
-
{ loader: () => loadPasikaConfigs(), severity:
|
|
1151
|
+
{ loader: () => loadPasikaConfigs("typescriptApp"), severity: pasikaTypescriptApp, isPasika: true },
|
|
1152
|
+
{ loader: () => loadPasikaConfigs("nextjsApp"), severity: pasikaNextjsApp, isPasika: true },
|
|
1190
1153
|
{ loader: () => Promise.resolve().then(() => (init_playwright(), playwright_exports)).then((m) => m.playwrightConfig), severity: playwright }
|
|
1191
1154
|
];
|
|
1192
1155
|
const eslintConfigs = [];
|
package/dist/styleguide.d.cts
CHANGED
|
@@ -16,7 +16,8 @@ interface StyleguideOptions {
|
|
|
16
16
|
typescript?: RuleSeverity;
|
|
17
17
|
react?: RuleSeverity;
|
|
18
18
|
next?: RuleSeverity;
|
|
19
|
-
|
|
19
|
+
pasikaTypescriptApp?: RuleSeverity;
|
|
20
|
+
pasikaNextjsApp?: RuleSeverity;
|
|
20
21
|
playwright?: RuleSeverity;
|
|
21
22
|
ignores?: string[];
|
|
22
23
|
additionalConfigs?: Linter.Config[];
|
package/dist/styleguide.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ interface StyleguideOptions {
|
|
|
16
16
|
typescript?: RuleSeverity;
|
|
17
17
|
react?: RuleSeverity;
|
|
18
18
|
next?: RuleSeverity;
|
|
19
|
-
|
|
19
|
+
pasikaTypescriptApp?: RuleSeverity;
|
|
20
|
+
pasikaNextjsApp?: RuleSeverity;
|
|
20
21
|
playwright?: RuleSeverity;
|
|
21
22
|
ignores?: string[];
|
|
22
23
|
additionalConfigs?: Linter.Config[];
|
package/dist/styleguide.js
CHANGED
|
@@ -1064,8 +1064,8 @@ var init_playwright = __esm({
|
|
|
1064
1064
|
|
|
1065
1065
|
// styleguide.ts
|
|
1066
1066
|
function styleguide(options) {
|
|
1067
|
-
const { browser, node, typescript, react: react2, next,
|
|
1068
|
-
const hasEslintOptions = browser ?? node ?? typescript ?? react2 ?? next ??
|
|
1067
|
+
const { browser, node, typescript, react: react2, next, pasikaTypescriptApp, pasikaNextjsApp, playwright, prettier } = options;
|
|
1068
|
+
const hasEslintOptions = browser ?? node ?? typescript ?? react2 ?? next ?? pasikaTypescriptApp ?? pasikaNextjsApp ?? playwright;
|
|
1069
1069
|
const prettierConfig = prettier ? getPrettierConfig(prettier) : void 0;
|
|
1070
1070
|
if (!hasEslintOptions) {
|
|
1071
1071
|
return { prettierConfig };
|
|
@@ -1096,75 +1096,38 @@ var init_styleguide = __esm({
|
|
|
1096
1096
|
};
|
|
1097
1097
|
JS_TS_FILES = [...JAVASCRIPT_FILES, ...TYPESCRIPT_FILES];
|
|
1098
1098
|
scopeToJsTs = (configs) => configs.map((config) => config.files ? config : { files: JS_TS_FILES, ...config });
|
|
1099
|
-
loadPasikaConfigs = async () => {
|
|
1100
|
-
const
|
|
1101
|
-
import("pasika/eslint"),
|
|
1102
|
-
import("@eslint/css"),
|
|
1103
|
-
import("@eslint/json"),
|
|
1104
|
-
import("@eslint/markdown")
|
|
1105
|
-
]);
|
|
1106
|
-
const cssPlugin = cssMod.default;
|
|
1107
|
-
const jsonPlugin = jsonMod.default;
|
|
1108
|
-
const markdownPlugin = markdownMod.default;
|
|
1099
|
+
loadPasikaConfigs = async (preset) => {
|
|
1100
|
+
const pasika = await import("pasika/eslint");
|
|
1109
1101
|
const pasikaJsTs = { rules: pasika.pasikaRules };
|
|
1110
|
-
const
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
{
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
},
|
|
1118
|
-
// All JS/TS files, so source-under-src can flag modules outside src/ that
|
|
1119
|
-
// the src-scoped block above never sees (config files are exempt in-rule).
|
|
1120
|
-
{
|
|
1121
|
-
files: JS_TS_FILES,
|
|
1122
|
-
plugins: { pasika: pasikaJsTs },
|
|
1123
|
-
rules: { "pasika/source-under-src": "error" }
|
|
1124
|
-
},
|
|
1125
|
-
{
|
|
1126
|
-
files: ["src/**/globals.css"],
|
|
1127
|
-
plugins: { css: cssPlugin, pasika: pasikaCss },
|
|
1128
|
-
language: "css/css",
|
|
1129
|
-
languageOptions: { tolerant: true },
|
|
1130
|
-
rules: Object.fromEntries(
|
|
1131
|
-
Object.keys(pasika.cssRules).filter((name) => name !== "global-css-location").map((name) => [`pasika/${name}`, "error"])
|
|
1132
|
-
)
|
|
1133
|
-
},
|
|
1134
|
-
{
|
|
1135
|
-
files: ["src/**/*.css"],
|
|
1136
|
-
plugins: { css: cssPlugin, pasika: pasikaCss },
|
|
1137
|
-
language: "css/css",
|
|
1138
|
-
languageOptions: { tolerant: true },
|
|
1139
|
-
rules: { "pasika/global-css-location": "error" }
|
|
1140
|
-
},
|
|
1141
|
-
{
|
|
1142
|
-
files: ["**/*.md"],
|
|
1143
|
-
ignores: ["**/_templates/**"],
|
|
1144
|
-
plugins: { markdown: markdownPlugin, pasika: { rules: pasika.mdRules } },
|
|
1145
|
-
language: "markdown/gfm",
|
|
1146
|
-
rules: Object.fromEntries(Object.keys(pasika.mdRules).map((name) => [`pasika/${name}`, "error"]))
|
|
1147
|
-
},
|
|
1148
|
-
{
|
|
1149
|
-
files: ["package.json"],
|
|
1150
|
-
plugins: {
|
|
1151
|
-
json: { languages: { json: jsonPlugin.languages.json } },
|
|
1152
|
-
pasika: pasikaJson
|
|
1153
|
-
},
|
|
1154
|
-
language: "json/json",
|
|
1155
|
-
rules: Object.fromEntries(Object.keys(pasika.jsonRules).map((name) => [`pasika/${name}`, "error"]))
|
|
1156
|
-
}
|
|
1157
|
-
];
|
|
1102
|
+
const app = pasika[preset];
|
|
1103
|
+
const sourceUnderSrc = {
|
|
1104
|
+
files: JS_TS_FILES,
|
|
1105
|
+
plugins: { pasika: pasikaJsTs },
|
|
1106
|
+
rules: { "pasika/source-under-src": "error" }
|
|
1107
|
+
};
|
|
1108
|
+
return [...app, sourceUnderSrc];
|
|
1158
1109
|
};
|
|
1159
1110
|
loadEslintConfigs = async (options) => {
|
|
1160
|
-
const {
|
|
1111
|
+
const {
|
|
1112
|
+
browser,
|
|
1113
|
+
node,
|
|
1114
|
+
typescript,
|
|
1115
|
+
react: react2,
|
|
1116
|
+
next,
|
|
1117
|
+
pasikaTypescriptApp,
|
|
1118
|
+
pasikaNextjsApp,
|
|
1119
|
+
playwright,
|
|
1120
|
+
ignores,
|
|
1121
|
+
additionalConfigs = []
|
|
1122
|
+
} = options;
|
|
1161
1123
|
const configLoaders = [
|
|
1162
1124
|
{ loader: () => Promise.resolve().then(() => (init_browser(), browser_exports)).then((m) => m.browserConfig), severity: browser },
|
|
1163
1125
|
{ loader: () => Promise.resolve().then(() => (init_node(), node_exports)).then((m) => m.nodeConfig), severity: node },
|
|
1164
1126
|
{ loader: () => Promise.resolve().then(() => (init_typescript2(), typescript_exports)).then((m) => m.typescriptConfig), severity: typescript },
|
|
1165
1127
|
{ loader: () => Promise.resolve().then(() => (init_react(), react_exports)).then((m) => m.reactConfig), severity: react2 },
|
|
1166
1128
|
{ loader: () => Promise.resolve().then(() => (init_next(), next_exports)).then((m) => m.nextConfig), severity: next },
|
|
1167
|
-
{ loader: () => loadPasikaConfigs(), severity:
|
|
1129
|
+
{ loader: () => loadPasikaConfigs("typescriptApp"), severity: pasikaTypescriptApp, isPasika: true },
|
|
1130
|
+
{ loader: () => loadPasikaConfigs("nextjsApp"), severity: pasikaNextjsApp, isPasika: true },
|
|
1168
1131
|
{ loader: () => Promise.resolve().then(() => (init_playwright(), playwright_exports)).then((m) => m.playwrightConfig), severity: playwright }
|
|
1169
1132
|
];
|
|
1170
1133
|
const eslintConfigs = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zirka",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"eslint-plugin-unicorn": "^73.0.0",
|
|
52
52
|
"globals": "^16.2.0",
|
|
53
53
|
"jiti": "^2.6.1",
|
|
54
|
-
"pasika": "^0.
|
|
54
|
+
"pasika": "^0.4.0",
|
|
55
55
|
"prettier-plugin-packagejson": "^2.5.14",
|
|
56
56
|
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
57
57
|
"typescript-eslint": "^8.68.0"
|