@superdispatch/eslint-plugin-ui 0.13.0 → 0.16.0-alpha.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/.turbo/turbo-version.log +2 -0
- package/package.json +3 -3
- package/pkg/.tsbuildinfo +1 -1
- package/pkg/rules/no-color-literals.js +0 -1
- package/pkg/rules/no-restricted-modules.js +3 -1
- package/pkg/utils/createRule.d.ts +2 -15
- package/pkg/utils/createRule.js +1 -1
- package/src/rules/no-color-literals.spec.ts +0 -2
- package/src/rules/no-color-literals.ts +0 -1
- package/src/rules/no-restricted-modules.spec.ts +19 -0
- package/src/rules/no-restricted-modules.ts +3 -1
- package/src/utils/createRule.ts +2 -1
|
@@ -17,6 +17,9 @@ const RESTRICTIONS = {
|
|
|
17
17
|
Snackbar: ['Snackbar', '@superdispatch/ui'],
|
|
18
18
|
SnackbarContent: ['SnackbarContent', '@superdispatch/ui'],
|
|
19
19
|
},
|
|
20
|
+
'@mui/lab': {
|
|
21
|
+
LoadingButton: ['Button', '@superdispatch/ui-lab'],
|
|
22
|
+
},
|
|
20
23
|
'@superdispatch/ui': {
|
|
21
24
|
Button: ['Button', '@superdispatch/ui-lab'],
|
|
22
25
|
GridStack: ['Stack', '@superdispatch/ui'],
|
|
@@ -34,7 +37,6 @@ exports.rule = (0, createRule_1.createRule)({
|
|
|
34
37
|
fixable: 'code',
|
|
35
38
|
docs: {
|
|
36
39
|
recommended: 'error',
|
|
37
|
-
category: 'Possible Errors',
|
|
38
40
|
description: 'Disallows to use Material UI modules',
|
|
39
41
|
},
|
|
40
42
|
schema: [],
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
meta: {
|
|
4
|
-
docs: {
|
|
5
|
-
description: string;
|
|
6
|
-
category: "Possible Errors" | "Best Practices" | "Stylistic Issues" | "Variables";
|
|
7
|
-
recommended: false | "error" | "warn";
|
|
8
|
-
suggestion?: boolean | undefined;
|
|
9
|
-
requiresTypeChecking?: boolean | undefined;
|
|
10
|
-
extendsBaseRule?: string | boolean | undefined;
|
|
11
|
-
};
|
|
12
|
-
} & Omit<import("@typescript-eslint/experimental-utils/dist/ts-eslint/Rule").RuleMetaData<TMessageIds>, "docs">;
|
|
13
|
-
defaultOptions: Readonly<TOptions>;
|
|
14
|
-
create: (context: Readonly<import("@typescript-eslint/experimental-utils/dist/ts-eslint/Rule").RuleContext<TMessageIds, TOptions>>, optionsWithDefault: Readonly<TOptions>) => TRuleListener;
|
|
15
|
-
}>) => import("@typescript-eslint/experimental-utils/dist/ts-eslint/Rule").RuleModule<TMessageIds, TOptions, TRuleListener>;
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/experimental-utils';
|
|
2
|
+
export declare const createRule: <TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends import("@typescript-eslint/experimental-utils/dist/ts-eslint/Rule").RuleListener = import("@typescript-eslint/experimental-utils/dist/ts-eslint/Rule").RuleListener>({ name, meta, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<TOptions, TMessageIds, TRuleListener>>) => import("@typescript-eslint/experimental-utils/dist/ts-eslint/Rule").RuleModule<TMessageIds, TOptions, TRuleListener>;
|
package/pkg/utils/createRule.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createRule = void 0;
|
|
4
4
|
const experimental_utils_1 = require("@typescript-eslint/experimental-utils");
|
|
5
|
-
exports.createRule = experimental_utils_1.ESLintUtils.RuleCreator((ruleName) => `
|
|
5
|
+
exports.createRule = experimental_utils_1.ESLintUtils.RuleCreator((ruleName) => `https://github.com/superdispatch/web-ui/blob/main/packages/eslint-plugin/src/rules/${ruleName}.ts`);
|
|
@@ -8,6 +8,25 @@ const ruleTester = new ESLintUtils.RuleTester({
|
|
|
8
8
|
ruleTester.run('no-restricted-modules', rule, {
|
|
9
9
|
valid: ['import { Box } from "styled-system"'],
|
|
10
10
|
invalid: [
|
|
11
|
+
{
|
|
12
|
+
code: 'import { LoadingButton } from "@mui/lab"',
|
|
13
|
+
errors: [
|
|
14
|
+
{
|
|
15
|
+
line: 1,
|
|
16
|
+
endLine: 1,
|
|
17
|
+
column: 10,
|
|
18
|
+
endColumn: 23,
|
|
19
|
+
messageId: 'restrict',
|
|
20
|
+
data: {
|
|
21
|
+
restrictedName: 'LoadingButton',
|
|
22
|
+
restrictedModule: '@mui/lab',
|
|
23
|
+
suggestedName: 'Button',
|
|
24
|
+
suggestedModule: '@superdispatch/ui-lab',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
|
|
11
30
|
{
|
|
12
31
|
code: 'import { Box } from "@material-ui/core"',
|
|
13
32
|
errors: [
|
|
@@ -26,6 +26,9 @@ const RESTRICTIONS: Restrictions = {
|
|
|
26
26
|
Snackbar: ['Snackbar', '@superdispatch/ui'],
|
|
27
27
|
SnackbarContent: ['SnackbarContent', '@superdispatch/ui'],
|
|
28
28
|
},
|
|
29
|
+
'@mui/lab': {
|
|
30
|
+
LoadingButton: ['Button', '@superdispatch/ui-lab'],
|
|
31
|
+
},
|
|
29
32
|
'@superdispatch/ui': {
|
|
30
33
|
Button: ['Button', '@superdispatch/ui-lab'],
|
|
31
34
|
GridStack: ['Stack', '@superdispatch/ui'],
|
|
@@ -44,7 +47,6 @@ export const rule = createRule<[], MessageIds>({
|
|
|
44
47
|
fixable: 'code',
|
|
45
48
|
docs: {
|
|
46
49
|
recommended: 'error',
|
|
47
|
-
category: 'Possible Errors',
|
|
48
50
|
description: 'Disallows to use Material UI modules',
|
|
49
51
|
},
|
|
50
52
|
schema: [],
|
package/src/utils/createRule.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/experimental-utils';
|
|
2
2
|
|
|
3
3
|
export const createRule = ESLintUtils.RuleCreator(
|
|
4
|
-
(ruleName) =>
|
|
4
|
+
(ruleName) =>
|
|
5
|
+
`https://github.com/superdispatch/web-ui/blob/main/packages/eslint-plugin/src/rules/${ruleName}.ts`,
|
|
5
6
|
);
|