@movable/ui 3.15.0 → 3.16.0-eslint.1

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
@@ -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,4 @@
1
+ export declare const rules: {
2
+ 'no-deprecated-grid': import("eslint").Rule.RuleModule;
3
+ };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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,4 @@
1
+ import type { Rule } from 'eslint';
2
+ declare const rule: Rule.RuleModule;
3
+ export default rule;
4
+ //# sourceMappingURL=no-deprecated-grid.d.ts.map
@@ -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,35 @@
1
1
  {
2
2
  "name": "@movable/ui",
3
- "version": "3.15.0",
3
+ "version": "3.16.0-eslint.1",
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",
10
+ "scripts"
9
11
  ],
12
+ "exports": {
13
+ ".": {
14
+ "import": "./lib/index.mjs",
15
+ "types": "./lib/index.d.ts"
16
+ },
17
+ "./eslint-plugin": {
18
+ "require": "./lib/eslint-plugin/index.js",
19
+ "types": "./lib/eslint-plugin/index.d.ts"
20
+ }
21
+ },
10
22
  "scripts": {
11
- "build": "vite build",
23
+ "build": "vite build && npm run build:eslint-plugin",
24
+ "build:eslint-plugin": "tsc --project eslint-plugin/tsconfig.json",
12
25
  "build-storybook": "storybook build",
13
26
  "dev": "vite",
14
27
  "lint": "run-p -n lint:src lint:cypress lint:stories",
15
28
  "lint:src": "tsc --project ./tsconfig.json && eslint -c ./.eslintrc.json ./src --report-unused-disable-directives --max-warnings 0",
16
29
  "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
30
  "lint:stories": "tsc --project ./tsconfig.json && eslint -c ./.eslintrc.json ./stories --report-unused-disable-directives --max-warnings 0",
18
- "prepare": "husky install",
31
+ "prepare": "husky install && npm run link:eslint-plugin",
32
+ "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
33
  "percy:storybook": "PERCY_TOKEN=$PERCY_TOKEN percy exec --parallel -- percy storybook ./storybook-static",
20
34
  "percy:upload": "PERCY_TOKEN=$PERCY_TOKEN percy build:finalize",
21
35
  "storybook": "storybook dev -p 6006",
@@ -61,6 +75,7 @@
61
75
  "@storybook/builder-vite": "^9.1.4",
62
76
  "@storybook/react-vite": "^9.1.4",
63
77
  "@swc/core": "^1.13.3",
78
+ "@types/eslint": "^9.6.1",
64
79
  "@types/lodash-es": "^4.17.0",
65
80
  "@types/react": "^18.2.19",
66
81
  "@types/react-dom": "^18.2.7",
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Creates a symlink for ESLint plugin resolution.
4
+ *
5
+ * ESLint legacy config resolves `plugins: ["@movable/ui"]` to `@movable/eslint-plugin-ui`.
6
+ * This script creates that symlink so the plugin works out of the box.
7
+ *
8
+ * Only runs when installed as a dependency (inside node_modules), not in the source repo.
9
+ */
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+
13
+ // Only run when installed as a dependency (path contains node_modules)
14
+ if (!__dirname.includes('node_modules')) {
15
+ process.exit(0);
16
+ }
17
+
18
+ const source = path.resolve(__dirname, '..', 'lib', 'eslint-plugin');
19
+ const target = path.resolve(__dirname, '..', '..', 'eslint-plugin-ui');
20
+
21
+ // Only create symlink if:
22
+ // 1. The source (built eslint-plugin) exists
23
+ // 2. The target doesn't already exist
24
+ if (fs.existsSync(source) && !fs.existsSync(target)) {
25
+ try {
26
+ fs.symlinkSync(source, target, 'dir');
27
+ } catch (err) {
28
+ // Silently fail - symlink creation may fail in some environments
29
+ // The plugin will still work with flat config via direct require
30
+ }
31
+ }