@cerios/sparta-lint-rules 0.0.0-stage → 0.0.2
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/LICENSE +8 -0
- package/README.md +251 -2
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +18 -0
- package/dist/index.mjs.map +1 -0
- package/dist/oxlint.cjs +18 -0
- package/dist/oxlint.cjs.map +1 -0
- package/dist/oxlint.d.cts +13 -0
- package/dist/oxlint.d.mts +13 -0
- package/dist/oxlint.mjs +19 -0
- package/dist/oxlint.mjs.map +1 -0
- package/dist/plugin-types-CXFDQLJF.d.cts +38 -0
- package/dist/plugin-types-CXFDQLJF.d.mts +38 -0
- package/dist/rules-D94N3gGx.mjs +2449 -0
- package/dist/rules-D94N3gGx.mjs.map +1 -0
- package/dist/rules-T_C5segG.cjs +2488 -0
- package/dist/rules-T_C5segG.cjs.map +1 -0
- package/dist/settings.cjs +0 -0
- package/dist/settings.d.cts +105 -0
- package/dist/settings.d.mts +105 -0
- package/dist/settings.mjs +1 -0
- package/package.json +120 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright © 2026 Cerios
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,252 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🛡️ SPARTA Lint Rules | By Cerios
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lint rules for **SPARTA** (Simply Powerful Automated Regression Test Architecture). They keep the layers of a SPARTA test project in their place: what may import what, where polling and checks belong, how files and classes are named, and how `@step` decorators are used.
|
|
4
|
+
|
|
5
|
+
The rules are written once against the ESLint rule API, which [oxlint's JS plugins](https://oxc.rs/docs/guide/usage/linter/js-plugins) also implement. That gives you:
|
|
6
|
+
|
|
7
|
+
- **oxlint** (recommended): fast, and the linter used in SPARTA projects.
|
|
8
|
+
- **ESLint** 9+: the same rules for projects that can't use oxlint.
|
|
9
|
+
|
|
10
|
+
Every rule is tested in both linters.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install --save-dev @cerios/sparta-lint-rules
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Requires Node.js `^22.18.0 || >=24.11.0`, and oxlint `>=1.91.0` or ESLint `>=9`.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### oxlint with `oxlint.config.ts`
|
|
27
|
+
|
|
28
|
+
Extend the recommended config:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import sparta from "@cerios/sparta-lint-rules/oxlint";
|
|
32
|
+
import { defineConfig } from "oxlint";
|
|
33
|
+
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
extends: [sparta],
|
|
36
|
+
rules: {
|
|
37
|
+
// override a rule if needed
|
|
38
|
+
"sparta/padding-lines": "off",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### oxlint with `.oxlintrc.json`
|
|
44
|
+
|
|
45
|
+
Register the plugin with `jsPlugins` and enable the rules you want:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"jsPlugins": ["@cerios/sparta-lint-rules"],
|
|
50
|
+
"rules": {
|
|
51
|
+
"sparta/architecture-boundaries": "error",
|
|
52
|
+
"sparta/class-matches-filename": "warn",
|
|
53
|
+
"sparta/director-composes-builders": "warn",
|
|
54
|
+
"sparta/expect-from-support": "error",
|
|
55
|
+
"sparta/file-naming": "warn",
|
|
56
|
+
"sparta/lines-between-class-members": "warn",
|
|
57
|
+
"sparta/member-ordering": "warn",
|
|
58
|
+
"sparta/no-direct-construction-in-tests": "error",
|
|
59
|
+
"sparta/no-expect-in-tests": "error",
|
|
60
|
+
"sparta/no-hard-waits": "error",
|
|
61
|
+
"sparta/no-nested-polling": "error",
|
|
62
|
+
"sparta/padding-lines": "warn",
|
|
63
|
+
"sparta/step-placeholders": "error",
|
|
64
|
+
"sparta/step-required": "warn"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### ESLint (flat config)
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
import sparta from "@cerios/sparta-lint-rules";
|
|
73
|
+
// eslint.config.mjs
|
|
74
|
+
import tsParser from "@typescript-eslint/parser";
|
|
75
|
+
|
|
76
|
+
export default [{ files: ["**/*.ts"], languageOptions: { parser: tsParser } }, sparta.configs.recommended];
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Project layout
|
|
82
|
+
|
|
83
|
+
The rules recognise files by their path, so they rely on the SPARTA folder conventions:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
<project>/
|
|
87
|
+
├── sparta/
|
|
88
|
+
│ ├── api/ # area: api, database, ui, mobile or desktop
|
|
89
|
+
│ │ ├── common/ # shared within the area
|
|
90
|
+
│ │ ├── builders/ # *-builder.ts, test data builders shared by the area's groups
|
|
91
|
+
│ │ ├── directors/ # *-director.ts, compose several builders
|
|
92
|
+
│ │ └── <group>/ # e.g. orders
|
|
93
|
+
│ │ ├── clients/ # *-client.ts
|
|
94
|
+
│ │ ├── services/ # *-service.ts
|
|
95
|
+
│ │ ├── steppers/ # *-stepper.ts
|
|
96
|
+
│ │ ├── asserters/ # *-asserter.ts
|
|
97
|
+
│ │ └── scenarios/ # *-scenario.ts
|
|
98
|
+
│ ├── database/<group>/ # repositories/, services/, steppers/, asserters/, scenarios/, ...
|
|
99
|
+
│ ├── ui/<group>/ # pages/, components/, steppers/, asserters/, scenarios/
|
|
100
|
+
│ ├── mobile/<group>/ # like ui, with screens/ (*-screen.ts) in place of pages/
|
|
101
|
+
│ ├── desktop/<group>/ # like ui, with windows/ (*-window.ts) in place of pages/, for Windows apps
|
|
102
|
+
│ ├── scenarios/ # cross-area scenarios
|
|
103
|
+
│ ├── fixtures/ # Playwright fixtures that wire everything up
|
|
104
|
+
│ ├── common/ # shared, area-independent code
|
|
105
|
+
│ └── support/ # expect with custom matchers, helpers
|
|
106
|
+
└── tests/ # the tests themselves
|
|
107
|
+
└── framework/ # framework tests; never checked
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Imports through the `@sparta/*` and `@tests/*` path aliases are resolved to `<project>/sparta/` and `<project>/tests/`, and the `paths` and `baseUrl` of your `tsconfig.json` are followed as well (see [import resolution](#import-resolution)). Files elsewhere are not affected by the path-based rules.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Configuration
|
|
115
|
+
|
|
116
|
+
Without configuration, the rules use the SPARTA names shown above. If your project uses other names, describe them in `settings.sparta`, a single block that all rules read.
|
|
117
|
+
|
|
118
|
+
**Settings describe your project; they never relax the rules.** A setting either:
|
|
119
|
+
|
|
120
|
+
- **maps your name onto a SPARTA concept**, so it gets all of that concept's checks: `areas: { web: "ui" }` makes `web/` follow every `ui` rule;
|
|
121
|
+
- **adds names to detect**, which only makes the rules stricter.
|
|
122
|
+
|
|
123
|
+
The standard names keep working next to yours. The layer rules, isolation and re-export checks themselves are not configurable. To switch a check off, use the linter itself (rule severity, `ignores`, overrides), where it stays visible.
|
|
124
|
+
|
|
125
|
+
| Setting | Default | What it does | Used by |
|
|
126
|
+
| ---------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
127
|
+
| `root` | nearest folder with a `package.json` | Project root: aliases resolve against it, and only paths below it are matched. A relative path resolves against the folder the linter runs in. | all path-based rules |
|
|
128
|
+
| `folders` | `{ sparta: "sparta", tests: "tests" }` | Names of the two top-level folders. Replaces the defaults. | all path-based rules |
|
|
129
|
+
| `areas` | `api`, `database`, `desktop`, `mobile`, `ui` | Extra area folders, each following a standard area: `{ web: "ui" }`. Each area folder is still isolated from the others. | all path-based rules |
|
|
130
|
+
| `layers` | `pages`, `steppers`, `services`, ... | Extra layer folders, each following a standard layer folder (its layer rules and file suffix): `{ "page-objects": "pages" }`. | `architecture-boundaries`, `file-naming`, `class-matches-filename`, `step-required`, `no-direct-construction-in-tests`, `director-composes-builders` |
|
|
131
|
+
| `aliases` | `@sparta/*` → `sparta`, `@tests/*` → `tests` | Extra path aliases pointing to `sparta` or `tests`: `{ "@app/*": "sparta" }`. Only needed when they are not in your tsconfig `paths`. | `architecture-boundaries`, `no-nested-polling`, `no-direct-construction-in-tests`, `director-composes-builders` |
|
|
132
|
+
| `supportModule` | `@sparta/support` | The module `expect` must come from. Replaces the default. | `expect-from-support` |
|
|
133
|
+
| `pollingMethods` | `toPass`, `toPassAndReturn`, `poll`, `pollAndReturn` | Extra retrying methods, called as `x.method(callback)` or `x(callback).method()`. | `no-nested-polling` |
|
|
134
|
+
| `stepDecorators` | `step` | Extra decorators that count as `@step`. | `step-required`, `step-placeholders` |
|
|
135
|
+
| `expectNames` | `expect`, `expectly…` | Extra assertion functions that tests must not call. | `no-expect-in-tests` |
|
|
136
|
+
|
|
137
|
+
A mistake in the settings stops the lint run with a clear message, so a typo can't silently weaken the checks:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
[@cerios/sparta-lint-rules] settings.sparta.layers.page-objects: unknown layer folder "pagez"; did you mean "pages"?
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
A name can't turn one SPARTA concept into another, so `areas: { ui: "api" }`, `areas: { common: "ui" }` and `layers: { pages: "steppers" }` are rejected.
|
|
144
|
+
|
|
145
|
+
### oxlint with `oxlint.config.ts`
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
import sparta from "@cerios/sparta-lint-rules/oxlint";
|
|
149
|
+
import type { SpartaSettings } from "@cerios/sparta-lint-rules/settings";
|
|
150
|
+
import { defineConfig } from "oxlint";
|
|
151
|
+
|
|
152
|
+
export default defineConfig({
|
|
153
|
+
extends: [sparta],
|
|
154
|
+
settings: {
|
|
155
|
+
sparta: {
|
|
156
|
+
areas: { web: "ui" },
|
|
157
|
+
layers: { "page-objects": "pages" },
|
|
158
|
+
aliases: { "@app/*": "sparta" },
|
|
159
|
+
supportModule: "@app/support",
|
|
160
|
+
} satisfies SpartaSettings,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### oxlint with `.oxlintrc.json`
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"jsPlugins": ["@cerios/sparta-lint-rules"],
|
|
170
|
+
"settings": {
|
|
171
|
+
"sparta": { "areas": { "web": "ui" } }
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### ESLint (flat config)
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
export default [
|
|
180
|
+
// ...
|
|
181
|
+
sparta.configs.recommended,
|
|
182
|
+
{ settings: { sparta: { areas: { web: "ui" } } } },
|
|
183
|
+
];
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Project root
|
|
187
|
+
|
|
188
|
+
The project root is the nearest folder, from the linted file upwards, that contains a `package.json`. This works for a standalone project and for a package in a monorepo. If `sparta/` lives in a folder without its own `package.json`, for example `e2e/` in a monorepo, set `root`. In ESLint, an absolute path such as `` `${import.meta.dirname}/e2e` `` doesn't depend on where the linter runs.
|
|
189
|
+
|
|
190
|
+
Only the part of a file's path below the root is matched against the SPARTA folder names. A checkout inside a folder named `tests` or `sparta` therefore doesn't change how files are classified, and files outside the root aren't checked by the path-based rules.
|
|
191
|
+
|
|
192
|
+
### Import resolution
|
|
193
|
+
|
|
194
|
+
The rules that follow imports (`architecture-boundaries`, `no-direct-construction-in-tests`, `no-nested-polling`) resolve them as TypeScript does, in this order:
|
|
195
|
+
|
|
196
|
+
1. relative imports (`./`, `../`);
|
|
197
|
+
2. `compilerOptions.paths` of the nearest `tsconfig.json` above the linted file, including what it `extends` (local files and packages). Of several targets, the first that exists is used, so `"@pages/*": ["sparta/ui/shop/pages/*"]` is checked like the folder it points to;
|
|
198
|
+
3. the `@sparta/*` and `@tests/*` aliases and `settings.sparta.aliases`, against the [project root](#project-root);
|
|
199
|
+
4. `compilerOptions.baseUrl`, for imports such as `sparta/ui/shop/pages/cart-page`, only when that file exists, so packages are never mistaken for project files.
|
|
200
|
+
|
|
201
|
+
Package imports are not checked. A `tsconfig.json` that can't be read, or whose `extends` can't be found, stops the lint run with a message naming the file. Only `tsconfig.json` is looked up; project references are not followed.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Rules
|
|
206
|
+
|
|
207
|
+
| Rule | Description | Recommended | Fix |
|
|
208
|
+
| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ----------- | --- |
|
|
209
|
+
| [architecture-boundaries](docs/rules/architecture-boundaries.md) | Enforce the SPARTA layer and isolation boundaries between imports | error | |
|
|
210
|
+
| [class-matches-filename](docs/rules/class-matches-filename.md) | One class per layer file, named after the file | warn | |
|
|
211
|
+
| [director-composes-builders](docs/rules/director-composes-builders.md) | A director composes several builders; a single-builder director belongs on the builder | warn | |
|
|
212
|
+
| [expect-from-support](docs/rules/expect-from-support.md) | Import `expect` from the support module inside `sparta/` | error | 🔧 |
|
|
213
|
+
| [file-naming](docs/rules/file-naming.md) | Files in a layer folder are kebab-case and end with the layer suffix | warn | |
|
|
214
|
+
| [lines-between-class-members](docs/rules/lines-between-class-members.md) | Blank line after multi-line methods; none between overloads | warn | 🔧 |
|
|
215
|
+
| [member-ordering](docs/rules/member-ordering.md) | Properties, constructor, methods; static first; public before private | warn | |
|
|
216
|
+
| [no-direct-construction-in-tests](docs/rules/no-direct-construction-in-tests.md) | No constructing layer classes (`new OrdersStepper()`) in tests; use fixtures | error | |
|
|
217
|
+
| [no-expect-in-tests](docs/rules/no-expect-in-tests.md) | No `expect` in tests; checks belong in steppers and asserters | error | |
|
|
218
|
+
| [no-hard-waits](docs/rules/no-hard-waits.md) | No `waitForTimeout` or `setTimeout` sleeps | error | |
|
|
219
|
+
| [no-nested-polling](docs/rules/no-nested-polling.md) | No poll inside a poll callback, also through calls into other files | error | |
|
|
220
|
+
| [padding-lines](docs/rules/padding-lines.md) | Blank lines after imports, around functions and object methods; none between overloads | warn | 🔧 |
|
|
221
|
+
| [step-placeholders](docs/rules/step-placeholders.md) | Validate `@step` description placeholders against the method parameters | error | 🔧 |
|
|
222
|
+
| [step-required](docs/rules/step-required.md) | Public methods of steppers, asserters and scenarios need `@step` | warn | |
|
|
223
|
+
|
|
224
|
+
`@step` refers to [`@cerios/playwright-step-decorator`](https://github.com/CeriosTesting/playwright-step-decorator).
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Development
|
|
229
|
+
|
|
230
|
+
```sh
|
|
231
|
+
npm install
|
|
232
|
+
npm run lint # oxlint, type-aware
|
|
233
|
+
npm run typecheck
|
|
234
|
+
npm run format:check
|
|
235
|
+
npm test # every rule in the oxlint and ESLint RuleTesters
|
|
236
|
+
npm run test:dist # build, then lint a fixture project with the built package via oxlint and ESLint
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
A new rule needs a file in `src/rules/`, an entry in `src/rules/index.ts`, tests in `tests/rules/` and a page in `docs/rules/`. `tests/plugin.test.ts` checks that these exist. Add a changeset (`npm run changeset`) for every user-facing change.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## License
|
|
244
|
+
|
|
245
|
+
MIT, Ronald Veth - Cerios
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Links
|
|
250
|
+
|
|
251
|
+
- [NPM Package](https://www.npmjs.com/package/@cerios/sparta-lint-rules)
|
|
252
|
+
- [GitHub Repository](https://github.com/CeriosTesting/sparta-lint-rules)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_rules = require("./rules-T_C5segG.cjs");
|
|
2
|
+
// src/index.ts
|
|
3
|
+
const plugin = {
|
|
4
|
+
meta: {
|
|
5
|
+
name: require_rules.PLUGIN_NAME,
|
|
6
|
+
version: "0.0.2"
|
|
7
|
+
},
|
|
8
|
+
rules: require_rules.rules,
|
|
9
|
+
configs: {}
|
|
10
|
+
};
|
|
11
|
+
plugin.configs.recommended = {
|
|
12
|
+
name: `${require_rules.PLUGIN_NAME}/recommended`,
|
|
13
|
+
plugins: { [require_rules.PLUGIN_NAME]: plugin },
|
|
14
|
+
rules: require_rules.recommendedRules
|
|
15
|
+
};
|
|
16
|
+
module.exports = plugin;
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["PLUGIN_NAME","rules","recommendedRules"],"sources":["../package.json","../src/index.ts"],"sourcesContent":["","import { version } from \"../package.json\";\n\nimport type { SpartaPlugin } from \"./plugin-types\";\nimport { PLUGIN_NAME, recommendedRules, rules } from \"./rules\";\n\nconst plugin: SpartaPlugin = {\n\tmeta: { name: PLUGIN_NAME, version },\n\trules,\n\tconfigs: {} as SpartaPlugin[\"configs\"],\n};\n\nplugin.configs.recommended = {\n\tname: `${PLUGIN_NAME}/recommended`,\n\tplugins: { [PLUGIN_NAME]: plugin },\n\trules: recommendedRules,\n};\n\nexport default plugin;\n"],"mappings":";;ACKA,MAAM,SAAuB;CAC5B,MAAM;EAAE,MAAMA,cAAAA;EAAa;CAAQ;CACnCC,OAAAA,cAAAA;CACA,SAAS,CAAC;AACX;AAEA,OAAO,QAAQ,cAAc;CAC5B,MAAM,GAAGD,cAAAA,YAAY;CACrB,SAAS,GAAGA,cAAAA,cAAc,OAAO;CACjC,OAAOE,cAAAA;AACR"}
|
package/dist/index.d.cts
ADDED
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { n as recommendedRules, r as rules, t as PLUGIN_NAME } from "./rules-D94N3gGx.mjs";
|
|
2
|
+
// src/index.ts
|
|
3
|
+
const plugin = {
|
|
4
|
+
meta: {
|
|
5
|
+
name: PLUGIN_NAME,
|
|
6
|
+
version: "0.0.2"
|
|
7
|
+
},
|
|
8
|
+
rules,
|
|
9
|
+
configs: {}
|
|
10
|
+
};
|
|
11
|
+
plugin.configs.recommended = {
|
|
12
|
+
name: `${PLUGIN_NAME}/recommended`,
|
|
13
|
+
plugins: { [PLUGIN_NAME]: plugin },
|
|
14
|
+
rules: recommendedRules
|
|
15
|
+
};
|
|
16
|
+
export { plugin as default };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../package.json","../src/index.ts"],"sourcesContent":["","import { version } from \"../package.json\";\n\nimport type { SpartaPlugin } from \"./plugin-types\";\nimport { PLUGIN_NAME, recommendedRules, rules } from \"./rules\";\n\nconst plugin: SpartaPlugin = {\n\tmeta: { name: PLUGIN_NAME, version },\n\trules,\n\tconfigs: {} as SpartaPlugin[\"configs\"],\n};\n\nplugin.configs.recommended = {\n\tname: `${PLUGIN_NAME}/recommended`,\n\tplugins: { [PLUGIN_NAME]: plugin },\n\trules: recommendedRules,\n};\n\nexport default plugin;\n"],"mappings":";;ACKA,MAAM,SAAuB;CAC5B,MAAM;EAAE,MAAM;EAAa;CAAQ;CACnC;CACA,SAAS,CAAC;AACX;AAEA,OAAO,QAAQ,cAAc;CAC5B,MAAM,GAAG,YAAY;CACrB,SAAS,GAAG,cAAc,OAAO;CACjC,OAAO;AACR"}
|
package/dist/oxlint.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/oxlint.ts
|
|
2
|
+
/**
|
|
3
|
+
* Recommended oxlint config, to extend from `oxlint.config.ts`:
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { defineConfig } from "oxlint";
|
|
7
|
+
* import sparta from "@cerios/sparta-lint-rules/oxlint";
|
|
8
|
+
*
|
|
9
|
+
* export default defineConfig({ extends: [sparta] });
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
const config = {
|
|
13
|
+
jsPlugins: ["@cerios/sparta-lint-rules"],
|
|
14
|
+
rules: require("./rules-T_C5segG.cjs").recommendedRules
|
|
15
|
+
};
|
|
16
|
+
module.exports = config;
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=oxlint.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oxlint.cjs","names":["recommendedRules"],"sources":["../src/oxlint.ts"],"sourcesContent":["import type { SpartaOxlintConfig } from \"./plugin-types\";\nimport { recommendedRules } from \"./rules\";\n\n/**\n * Recommended oxlint config, to extend from `oxlint.config.ts`:\n *\n * ```ts\n * import { defineConfig } from \"oxlint\";\n * import sparta from \"@cerios/sparta-lint-rules/oxlint\";\n *\n * export default defineConfig({ extends: [sparta] });\n * ```\n */\nconst config: SpartaOxlintConfig = {\n\tjsPlugins: [\"@cerios/sparta-lint-rules\"],\n\trules: recommendedRules,\n};\n\nexport default config;\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,SAA6B;CAClC,WAAW,CAAC,2BAA2B;CACvC,O,8BAAOA,CAAAA,CAAAA;AACR"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as SpartaOxlintConfig } from "./plugin-types-CXFDQLJF.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Recommended oxlint config, to extend from `oxlint.config.ts`:
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { defineConfig } from "oxlint";
|
|
7
|
+
* import sparta from "@cerios/sparta-lint-rules/oxlint";
|
|
8
|
+
*
|
|
9
|
+
* export default defineConfig({ extends: [sparta] });
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
declare const config: SpartaOxlintConfig;
|
|
13
|
+
export = config;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as SpartaOxlintConfig } from "./plugin-types-CXFDQLJF.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Recommended oxlint config, to extend from `oxlint.config.ts`:
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { defineConfig } from "oxlint";
|
|
7
|
+
* import sparta from "@cerios/sparta-lint-rules/oxlint";
|
|
8
|
+
*
|
|
9
|
+
* export default defineConfig({ extends: [sparta] });
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
declare const config: SpartaOxlintConfig;
|
|
13
|
+
export = config;
|
package/dist/oxlint.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { n as recommendedRules } from "./rules-D94N3gGx.mjs";
|
|
2
|
+
// src/oxlint.ts
|
|
3
|
+
/**
|
|
4
|
+
* Recommended oxlint config, to extend from `oxlint.config.ts`:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { defineConfig } from "oxlint";
|
|
8
|
+
* import sparta from "@cerios/sparta-lint-rules/oxlint";
|
|
9
|
+
*
|
|
10
|
+
* export default defineConfig({ extends: [sparta] });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
const config = {
|
|
14
|
+
jsPlugins: ["@cerios/sparta-lint-rules"],
|
|
15
|
+
rules: recommendedRules
|
|
16
|
+
};
|
|
17
|
+
export { config as default };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=oxlint.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oxlint.mjs","names":[],"sources":["../src/oxlint.ts"],"sourcesContent":["import type { SpartaOxlintConfig } from \"./plugin-types\";\nimport { recommendedRules } from \"./rules\";\n\n/**\n * Recommended oxlint config, to extend from `oxlint.config.ts`:\n *\n * ```ts\n * import { defineConfig } from \"oxlint\";\n * import sparta from \"@cerios/sparta-lint-rules/oxlint\";\n *\n * export default defineConfig({ extends: [sparta] });\n * ```\n */\nconst config: SpartaOxlintConfig = {\n\tjsPlugins: [\"@cerios/sparta-lint-rules\"],\n\trules: recommendedRules,\n};\n\nexport default config;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,SAA6B;CAClC,WAAW,CAAC,2BAA2B;CACvC,OAAO;AACR"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare const rules: {
|
|
2
|
+
"architecture-boundaries": import("@oxlint/plugins").CreateRule;
|
|
3
|
+
"class-matches-filename": import("@oxlint/plugins").CreateRule;
|
|
4
|
+
"director-composes-builders": import("@oxlint/plugins").CreateRule;
|
|
5
|
+
"expect-from-support": import("@oxlint/plugins").CreateRule;
|
|
6
|
+
"file-naming": import("@oxlint/plugins").CreateRule;
|
|
7
|
+
"lines-between-class-members": import("@oxlint/plugins").CreateRule;
|
|
8
|
+
"member-ordering": import("@oxlint/plugins").CreateRule;
|
|
9
|
+
"no-direct-construction-in-tests": import("@oxlint/plugins").CreateRule;
|
|
10
|
+
"no-expect-in-tests": import("@oxlint/plugins").CreateRule;
|
|
11
|
+
"no-hard-waits": import("@oxlint/plugins").CreateRule;
|
|
12
|
+
"no-nested-polling": import("@oxlint/plugins").CreateRule;
|
|
13
|
+
"padding-lines": import("@oxlint/plugins").CreateRule;
|
|
14
|
+
"step-placeholders": import("@oxlint/plugins").CreateRule;
|
|
15
|
+
"step-required": import("@oxlint/plugins").CreateRule;
|
|
16
|
+
};
|
|
17
|
+
type Severity = "error" | "warn";
|
|
18
|
+
/** ESLint flat config entry. Typed structurally so the package does not depend on ESLint's types. */
|
|
19
|
+
interface SpartaFlatConfig {
|
|
20
|
+
name: string;
|
|
21
|
+
plugins: Record<string, SpartaPlugin>;
|
|
22
|
+
rules: Record<string, Severity>;
|
|
23
|
+
}
|
|
24
|
+
interface SpartaPlugin {
|
|
25
|
+
meta: {
|
|
26
|
+
name: string;
|
|
27
|
+
version: string;
|
|
28
|
+
};
|
|
29
|
+
rules: typeof rules;
|
|
30
|
+
configs: {
|
|
31
|
+
recommended: SpartaFlatConfig;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface SpartaOxlintConfig {
|
|
35
|
+
jsPlugins: string[];
|
|
36
|
+
rules: Record<string, Severity>;
|
|
37
|
+
}
|
|
38
|
+
export { SpartaPlugin as n, SpartaOxlintConfig as t };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare const rules: {
|
|
2
|
+
"architecture-boundaries": import("@oxlint/plugins").CreateRule;
|
|
3
|
+
"class-matches-filename": import("@oxlint/plugins").CreateRule;
|
|
4
|
+
"director-composes-builders": import("@oxlint/plugins").CreateRule;
|
|
5
|
+
"expect-from-support": import("@oxlint/plugins").CreateRule;
|
|
6
|
+
"file-naming": import("@oxlint/plugins").CreateRule;
|
|
7
|
+
"lines-between-class-members": import("@oxlint/plugins").CreateRule;
|
|
8
|
+
"member-ordering": import("@oxlint/plugins").CreateRule;
|
|
9
|
+
"no-direct-construction-in-tests": import("@oxlint/plugins").CreateRule;
|
|
10
|
+
"no-expect-in-tests": import("@oxlint/plugins").CreateRule;
|
|
11
|
+
"no-hard-waits": import("@oxlint/plugins").CreateRule;
|
|
12
|
+
"no-nested-polling": import("@oxlint/plugins").CreateRule;
|
|
13
|
+
"padding-lines": import("@oxlint/plugins").CreateRule;
|
|
14
|
+
"step-placeholders": import("@oxlint/plugins").CreateRule;
|
|
15
|
+
"step-required": import("@oxlint/plugins").CreateRule;
|
|
16
|
+
};
|
|
17
|
+
type Severity = "error" | "warn";
|
|
18
|
+
/** ESLint flat config entry. Typed structurally so the package does not depend on ESLint's types. */
|
|
19
|
+
interface SpartaFlatConfig {
|
|
20
|
+
name: string;
|
|
21
|
+
plugins: Record<string, SpartaPlugin>;
|
|
22
|
+
rules: Record<string, Severity>;
|
|
23
|
+
}
|
|
24
|
+
interface SpartaPlugin {
|
|
25
|
+
meta: {
|
|
26
|
+
name: string;
|
|
27
|
+
version: string;
|
|
28
|
+
};
|
|
29
|
+
rules: typeof rules;
|
|
30
|
+
configs: {
|
|
31
|
+
recommended: SpartaFlatConfig;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface SpartaOxlintConfig {
|
|
35
|
+
jsPlugins: string[];
|
|
36
|
+
rules: Record<string, Severity>;
|
|
37
|
+
}
|
|
38
|
+
export { SpartaPlugin as n, SpartaOxlintConfig as t };
|