eslint-plugin-recursica 0.2.0
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 +42 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/rules/no-over-styled.d.ts +3 -0
- package/dist/rules/no-over-styled.d.ts.map +1 -0
- package/dist/rules/no-over-styled.js +24 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# eslint-plugin-recursica
|
|
2
|
+
|
|
3
|
+
ESLint plugin enforcing Recursica design-system conventions in applications that consume the Recursica adapters.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev eslint-plugin-recursica
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Flat config (`eslint.config.js`):
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import recursica from "eslint-plugin-recursica";
|
|
17
|
+
|
|
18
|
+
export default [
|
|
19
|
+
{
|
|
20
|
+
plugins: { recursica },
|
|
21
|
+
rules: {
|
|
22
|
+
"recursica/no-over-styled": "error",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or use the recommended config directly:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import recursica from "eslint-plugin-recursica";
|
|
32
|
+
|
|
33
|
+
export default [recursica.configs.recommended];
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Rules
|
|
37
|
+
|
|
38
|
+
| Rule | Description | Recommended |
|
|
39
|
+
| ---------------- | --------------------------------------------------------------------- | ----------- |
|
|
40
|
+
| `no-over-styled` | Disallows the `overStyled` escape-hatch prop on Recursica components. | `error` |
|
|
41
|
+
|
|
42
|
+
`no-over-styled` is a plain ESLint rule — set it to `"warn"` in your own config to downgrade it from the default `"error"`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const rules: {
|
|
2
|
+
"no-over-styled": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noOverStyled", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
|
+
};
|
|
4
|
+
export declare const configs: {
|
|
5
|
+
recommended: {
|
|
6
|
+
plugins: string[];
|
|
7
|
+
rules: {
|
|
8
|
+
"recursica/no-over-styled": string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
declare const plugin: {
|
|
13
|
+
rules: {
|
|
14
|
+
"no-over-styled": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noOverStyled", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
15
|
+
};
|
|
16
|
+
configs: {
|
|
17
|
+
recommended: {
|
|
18
|
+
plugins: string[];
|
|
19
|
+
rules: {
|
|
20
|
+
"recursica/no-over-styled": string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default plugin;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK;;CAEjB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAEF,QAAA,MAAM,MAAM;;;;;;;;;;;;CAGX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { noOverStyled } from "./rules/no-over-styled.js";
|
|
2
|
+
export const rules = {
|
|
3
|
+
"no-over-styled": noOverStyled,
|
|
4
|
+
};
|
|
5
|
+
export const configs = {
|
|
6
|
+
recommended: {
|
|
7
|
+
plugins: ["recursica"],
|
|
8
|
+
rules: {
|
|
9
|
+
"recursica/no-over-styled": "error",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
const plugin = {
|
|
14
|
+
rules,
|
|
15
|
+
configs,
|
|
16
|
+
};
|
|
17
|
+
export default plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-over-styled.d.ts","sourceRoot":"","sources":["../../src/rules/no-over-styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,eAAO,MAAM,YAAY,+EAuBvB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
const createRule = ESLintUtils.RuleCreator.withoutDocs;
|
|
3
|
+
export const noOverStyled = createRule({
|
|
4
|
+
meta: {
|
|
5
|
+
type: "problem",
|
|
6
|
+
docs: {
|
|
7
|
+
description: "Disallow the `overStyled` escape-hatch prop on Recursica components.",
|
|
8
|
+
},
|
|
9
|
+
schema: [],
|
|
10
|
+
messages: {
|
|
11
|
+
noOverStyled: "`overStyled` bypasses Recursica's design-token sandboxing and should only exist as short-term technical debt (see OVERSTYLING.md). Remove it or refactor to use a supported Recursica variant/prop instead.",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultOptions: [],
|
|
15
|
+
create(context) {
|
|
16
|
+
return {
|
|
17
|
+
JSXAttribute(node) {
|
|
18
|
+
if (node.name.type === "JSXIdentifier" && node.name.name === "overStyled") {
|
|
19
|
+
context.report({ node, messageId: "noOverStyled" });
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-plugin-recursica",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "ESLint plugin enforcing Recursica design-system conventions in consuming applications.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"homepage": "https://github.com/borderux/recursica/tree/main/packages/eslint-plugin",
|
|
7
|
+
"author": "hi@borderux.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/borderux/recursica.git",
|
|
11
|
+
"directory": "packages/eslint-plugin"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"require": "./dist/index.js",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"eslint",
|
|
29
|
+
"eslintplugin",
|
|
30
|
+
"eslint-plugin",
|
|
31
|
+
"recursica"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -p tsconfig.build.json",
|
|
35
|
+
"dev": "tsc --watch",
|
|
36
|
+
"clean": "rm -rf dist",
|
|
37
|
+
"lint": "eslint .",
|
|
38
|
+
"check-types": "tsc --noEmit",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"test:watch": "vitest"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"eslint": "^8.57.0 || ^9.0.0"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@typescript-eslint/utils": "^8.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@eslint/js": "^9.28.0",
|
|
50
|
+
"@types/node": "^20.11.0",
|
|
51
|
+
"@typescript-eslint/rule-tester": "^8.68.0",
|
|
52
|
+
"eslint": "^9.28.0",
|
|
53
|
+
"globals": "^16.2.0",
|
|
54
|
+
"typescript": "~5.8.3",
|
|
55
|
+
"typescript-eslint": "^8.33.0",
|
|
56
|
+
"vitest": "^3.2.4"
|
|
57
|
+
},
|
|
58
|
+
"license": "MIT"
|
|
59
|
+
}
|