@movable/ui 3.15.0 → 3.16.0-eslint.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 +16 -0
- package/lib/eslint-plugin/configs/recommended.d.ts +11 -0
- package/lib/eslint-plugin/configs/recommended.d.ts.map +1 -0
- package/lib/eslint-plugin/configs/recommended.js +13 -0
- package/lib/eslint-plugin/index.d.ts +24 -0
- package/lib/eslint-plugin/index.d.ts.map +1 -0
- package/lib/eslint-plugin/index.js +20 -0
- package/lib/eslint-plugin/rules/index.d.ts +4 -0
- package/lib/eslint-plugin/rules/index.d.ts.map +1 -0
- package/lib/eslint-plugin/rules/index.js +10 -0
- package/lib/eslint-plugin/rules/no-deprecated-grid.d.ts +4 -0
- package/lib/eslint-plugin/rules/no-deprecated-grid.d.ts.map +1 -0
- package/lib/eslint-plugin/rules/no-deprecated-grid.js +43 -0
- package/package.json +18 -4
package/README.md
CHANGED
|
@@ -65,6 +65,22 @@ yarn add @movable/ui@3.4.1-alpha.0
|
|
|
65
65
|
|
|
66
66
|
View all available versions at: https://www.npmjs.com/package/@movable/ui?activeTab=versions
|
|
67
67
|
|
|
68
|
+
## ESLint Plugin
|
|
69
|
+
|
|
70
|
+
This package includes an ESLint plugin with rules for consistent usage of `@movable/ui` components. It helps enforce best practices like using `Grid2` instead of deprecated `Grid`.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# In your consuming app's .eslintrc
|
|
74
|
+
{
|
|
75
|
+
"plugins": ["@movable/ui"],
|
|
76
|
+
"rules": {
|
|
77
|
+
"@movable/ui/no-deprecated-grid": "error"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
See [eslint-plugin/README.md](./eslint-plugin/README.md) for full documentation.
|
|
83
|
+
|
|
68
84
|
## Conventional Commits
|
|
69
85
|
|
|
70
86
|
This repo has [conventional-commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) We lint for this both pre-commit and on PR actions. It is **required** and will not pass without it.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recommended ESLint configuration for @movable/ui consumers.
|
|
3
|
+
*
|
|
4
|
+
* Enforces best practices for importing and using @movable/ui components.
|
|
5
|
+
*/
|
|
6
|
+
export declare const recommended: {
|
|
7
|
+
rules: {
|
|
8
|
+
'@movable/ui/no-deprecated-grid': string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=recommended.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommended.d.ts","sourceRoot":"","sources":["../../../eslint-plugin/configs/recommended.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,WAAW;;;;CAIvB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Recommended ESLint configuration for @movable/ui consumers.
|
|
4
|
+
*
|
|
5
|
+
* Enforces best practices for importing and using @movable/ui components.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.recommended = void 0;
|
|
9
|
+
exports.recommended = {
|
|
10
|
+
rules: {
|
|
11
|
+
'@movable/ui/no-deprecated-grid': 'error',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @movable/ui ESLint Plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides shared ESLint rules for Movable Ink applications
|
|
5
|
+
* consuming the @movable/ui component library.
|
|
6
|
+
*/
|
|
7
|
+
declare const plugin: {
|
|
8
|
+
meta: {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
};
|
|
12
|
+
configs: {
|
|
13
|
+
recommended: {
|
|
14
|
+
rules: {
|
|
15
|
+
'@movable/ui/no-deprecated-grid': string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
rules: {
|
|
20
|
+
'no-deprecated-grid': import("eslint").Rule.RuleModule;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export = plugin;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../eslint-plugin/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;CASX,CAAC;AAEF,SAAS,MAAM,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @movable/ui ESLint Plugin
|
|
4
|
+
*
|
|
5
|
+
* Provides shared ESLint rules for Movable Ink applications
|
|
6
|
+
* consuming the @movable/ui component library.
|
|
7
|
+
*/
|
|
8
|
+
const recommended_1 = require("./configs/recommended");
|
|
9
|
+
const rules_1 = require("./rules");
|
|
10
|
+
const plugin = {
|
|
11
|
+
meta: {
|
|
12
|
+
name: '@movable/ui',
|
|
13
|
+
version: '1.0.0',
|
|
14
|
+
},
|
|
15
|
+
configs: {
|
|
16
|
+
recommended: recommended_1.recommended,
|
|
17
|
+
},
|
|
18
|
+
rules: rules_1.rules,
|
|
19
|
+
};
|
|
20
|
+
module.exports = plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../eslint-plugin/rules/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK;;CAEjB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.rules = void 0;
|
|
7
|
+
const no_deprecated_grid_1 = __importDefault(require("./no-deprecated-grid"));
|
|
8
|
+
exports.rules = {
|
|
9
|
+
'no-deprecated-grid': no_deprecated_grid_1.default,
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-deprecated-grid.d.ts","sourceRoot":"","sources":["../../../eslint-plugin/rules/no-deprecated-grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UA4ChB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const rule = {
|
|
4
|
+
meta: {
|
|
5
|
+
type: 'suggestion',
|
|
6
|
+
docs: {
|
|
7
|
+
description: 'Disallow importing deprecated Grid v1 from MUI',
|
|
8
|
+
recommended: true,
|
|
9
|
+
},
|
|
10
|
+
messages: {
|
|
11
|
+
noGridV1: "Please use Grid2 from '@mui/material/Grid2' instead. Grid v1 is deprecated.",
|
|
12
|
+
},
|
|
13
|
+
schema: [],
|
|
14
|
+
},
|
|
15
|
+
create(context) {
|
|
16
|
+
return {
|
|
17
|
+
ImportDeclaration(node) {
|
|
18
|
+
const source = node.source.value;
|
|
19
|
+
// Check for: import { Grid } from '@mui/material'
|
|
20
|
+
if (source === '@mui/material') {
|
|
21
|
+
for (const specifier of node.specifiers) {
|
|
22
|
+
if (specifier.type === 'ImportSpecifier' &&
|
|
23
|
+
specifier.imported.type === 'Identifier' &&
|
|
24
|
+
specifier.imported.name === 'Grid') {
|
|
25
|
+
context.report({
|
|
26
|
+
node: specifier,
|
|
27
|
+
messageId: 'noGridV1',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Check for: import Grid from '@mui/material/Grid'
|
|
33
|
+
if (source === '@mui/material/Grid') {
|
|
34
|
+
context.report({
|
|
35
|
+
node,
|
|
36
|
+
messageId: 'noGridV1',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
exports.default = rule;
|
package/package.json
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movable/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0-eslint.0",
|
|
4
4
|
"description": "Movable Ink's shared MUI components and MUI theme for our vite applications",
|
|
5
5
|
"module": "lib/index.mjs",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"lib"
|
|
8
|
+
"lib",
|
|
9
|
+
"lib/eslint-plugin"
|
|
9
10
|
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./lib/index.mjs",
|
|
14
|
+
"types": "./lib/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./eslint-plugin": {
|
|
17
|
+
"require": "./lib/eslint-plugin/index.js",
|
|
18
|
+
"types": "./lib/eslint-plugin/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
10
21
|
"scripts": {
|
|
11
|
-
"build": "vite build",
|
|
22
|
+
"build": "vite build && npm run build:eslint-plugin",
|
|
23
|
+
"build:eslint-plugin": "tsc --project eslint-plugin/tsconfig.json",
|
|
12
24
|
"build-storybook": "storybook build",
|
|
13
25
|
"dev": "vite",
|
|
14
26
|
"lint": "run-p -n lint:src lint:cypress lint:stories",
|
|
15
27
|
"lint:src": "tsc --project ./tsconfig.json && eslint -c ./.eslintrc.json ./src --report-unused-disable-directives --max-warnings 0",
|
|
16
28
|
"lint:cypress": "tsc --project ./cypress/tsconfig.json && eslint -c ./cypress/.eslintrc.json ./cypress --resolve-plugins-relative-to ./cypress --report-unused-disable-directives --max-warnings 0 --no-error-on-unmatched-pattern",
|
|
17
29
|
"lint:stories": "tsc --project ./tsconfig.json && eslint -c ./.eslintrc.json ./stories --report-unused-disable-directives --max-warnings 0",
|
|
18
|
-
"prepare": "husky install",
|
|
30
|
+
"prepare": "husky install && npm run link:eslint-plugin",
|
|
31
|
+
"link:eslint-plugin": "[ -d lib/eslint-plugin ] && mkdir -p node_modules/@movable && ln -sf ../../lib/eslint-plugin node_modules/@movable/eslint-plugin-ui || true",
|
|
19
32
|
"percy:storybook": "PERCY_TOKEN=$PERCY_TOKEN percy exec --parallel -- percy storybook ./storybook-static",
|
|
20
33
|
"percy:upload": "PERCY_TOKEN=$PERCY_TOKEN percy build:finalize",
|
|
21
34
|
"storybook": "storybook dev -p 6006",
|
|
@@ -61,6 +74,7 @@
|
|
|
61
74
|
"@storybook/builder-vite": "^9.1.4",
|
|
62
75
|
"@storybook/react-vite": "^9.1.4",
|
|
63
76
|
"@swc/core": "^1.13.3",
|
|
77
|
+
"@types/eslint": "^9.6.1",
|
|
64
78
|
"@types/lodash-es": "^4.17.0",
|
|
65
79
|
"@types/react": "^18.2.19",
|
|
66
80
|
"@types/react-dom": "^18.2.7",
|