eslint-plugin-gamut 3.0.3-alpha.f96830.0 → 3.1.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 +2 -1
- package/dist/createRule.d.ts +3 -1
- package/dist/gamut-import-paths.d.ts +3 -4
- package/dist/gamut-import-paths.js +7 -3
- package/dist/gamut-import-paths.js.map +1 -1
- package/dist/index.d.ts +15 -9
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/no-css-standalone.d.ts +3 -3
- package/dist/no-css-standalone.js +1 -2
- package/dist/no-css-standalone.js.map +1 -1
- package/dist/no-inline-style.d.ts +4 -0
- package/dist/no-inline-style.js +32 -0
- package/dist/no-inline-style.js.map +1 -0
- package/dist/no-kbd-element.d.ts +4 -0
- package/dist/no-kbd-element.js +32 -0
- package/dist/no-kbd-element.js.map +1 -0
- package/dist/prefer-themed.d.ts +3 -3
- package/dist/prefer-themed.js +8 -8
- package/dist/prefer-themed.js.map +1 -1
- package/dist/recommended.d.ts +1 -0
- package/dist/recommended.js +1 -0
- package/dist/recommended.js.map +1 -1
- package/package.json +16 -24
- package/.turbo/turbo-build.log +0 -4
- package/CHANGELOG.md +0 -8
- package/LICENSE +0 -21
- package/dist/no-css-standalone.test.d.ts +0 -1
- package/dist/no-css-standalone.test.js +0 -66
- package/dist/no-css-standalone.test.js.map +0 -1
- package/dist/prefer-themed.test.d.ts +0 -1
- package/dist/prefer-themed.test.js +0 -43
- package/dist/prefer-themed.test.js.map +0 -1
- package/jest.config.js +0 -5
- package/tsconfig.json +0 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `eslint-plugin-gamut`
|
|
2
2
|
|
|
3
|
-
Recommended eslint
|
|
3
|
+
Recommended eslint plugins for all Gamut applications. ✨
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -16,6 +16,7 @@ module.exports = {
|
|
|
16
16
|
'gamut/prefer-themed': 'error',
|
|
17
17
|
'gamut/no-css-standalone': 'error',
|
|
18
18
|
'gamut/import-paths': 'error',
|
|
19
|
+
'gamut/no-inline-style': 'error',
|
|
19
20
|
},
|
|
20
21
|
};
|
|
21
22
|
```
|
package/dist/createRule.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const createRule: <
|
|
2
|
+
export declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener> & {
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}>;
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"removeDist" | "removeSrc" | "useRelativeImport", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener> & {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
5
4
|
export default _default;
|
|
@@ -8,7 +8,9 @@ exports.default = (0, createRule_1.createRule)({
|
|
|
8
8
|
const filename = context.getFilename();
|
|
9
9
|
const importPath = node.source.value;
|
|
10
10
|
const fileDirectory = filename.split('/packages/')[1].split('/')[0];
|
|
11
|
-
const importPackage = importPath
|
|
11
|
+
const importPackage = importPath
|
|
12
|
+
.split('@codecademy/')[1]
|
|
13
|
+
.split('/')[0];
|
|
12
14
|
if (fileDirectory === importPackage) {
|
|
13
15
|
context.report({
|
|
14
16
|
messageId: 'useRelativeImport',
|
|
@@ -34,7 +36,10 @@ exports.default = (0, createRule_1.createRule)({
|
|
|
34
36
|
context.report({
|
|
35
37
|
...(importPath.endsWith('/dist') && {
|
|
36
38
|
fix: (fixer) => {
|
|
37
|
-
return fixer.removeRange([
|
|
39
|
+
return fixer.removeRange([
|
|
40
|
+
indexOfDist + 1,
|
|
41
|
+
node.range[1] - 2,
|
|
42
|
+
]);
|
|
38
43
|
},
|
|
39
44
|
}),
|
|
40
45
|
messageId: 'removeDist',
|
|
@@ -48,7 +53,6 @@ exports.default = (0, createRule_1.createRule)({
|
|
|
48
53
|
meta: {
|
|
49
54
|
docs: {
|
|
50
55
|
description: 'Ensure Gamut import statements have proper module paths.',
|
|
51
|
-
recommended: 'error',
|
|
52
56
|
},
|
|
53
57
|
fixable: 'code',
|
|
54
58
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gamut-import-paths.js","sourceRoot":"","sources":["../src/gamut-import-paths.ts"],"names":[],"mappings":";;AAEA,6CAA0C;AAE1C,kBAAe,IAAA,uBAAU,EAAC;IACxB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,gEAAgE,
|
|
1
|
+
{"version":3,"file":"gamut-import-paths.js","sourceRoot":"","sources":["../src/gamut-import-paths.ts"],"names":[],"mappings":";;AAEA,6CAA0C;AAE1C,kBAAe,IAAA,uBAAU,EAAC;IACxB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,gEAAgE,EAC9D,UAAU,IAAgC;gBACxC,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;gBACvC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;gBAErC,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBACpE,MAAM,aAAa,GAAG,UAAU;qBAC7B,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;qBACxB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBAEjB,IAAI,aAAa,KAAK,aAAa,EAAE,CAAC;oBACpC,OAAO,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,mBAAmB;wBAC9B,IAAI;qBACL,CAAC,CAAC;oBACH,OAAO;gBACT,CAAC;gBAED,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBAChC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;oBACpE,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI;4BACjC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,UAAU,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;4BAChE,CAAC;yBACF,CAAC;wBACF,SAAS,EAAE,WAAW;wBACtB,IAAI;qBACL,CAAC,CAAC;oBACH,OAAO;gBACT,CAAC;gBACD,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;oBACjC,MAAM,WAAW,GACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;oBACpD,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI;4BAClC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,OAAO,KAAK,CAAC,WAAW,CAAC;oCACvB,WAAW,GAAG,CAAC;oCACf,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;iCAClB,CAAC,CAAC;4BACL,CAAC;yBACF,CAAC;wBACF,SAAS,EAAE,YAAY;wBACvB,IAAI;qBACL,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACJ,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,0DAA0D;SACxE;QACD,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE;YACR,UAAU,EACR,kEAAkE;YACpE,SAAS,EACP,iEAAiE;YACnE,iBAAiB,EAAE,gDAAgD;SACpE;QACD,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,EAAE;KACX;IACD,IAAI,EAAE,oBAAoB;CAC3B,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import recommended from './recommended';
|
|
2
2
|
declare const rules: {
|
|
3
|
-
'import-paths': import("@typescript-eslint/utils/dist/ts-eslint
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
'no-css-standalone': import("@typescript-eslint/utils/dist/ts-eslint
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
'
|
|
10
|
-
|
|
11
|
-
}
|
|
3
|
+
'import-paths': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"removeDist" | "removeSrc" | "useRelativeImport", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener> & {
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
'no-css-standalone': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"noCssStandalone", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener> & {
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
'no-inline-style': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"noInlineStyle", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener> & {
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
'no-kbd-element': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"noKbdElement", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener> & {
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
'prefer-themed': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"preferThemed", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener> & {
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
12
18
|
};
|
|
13
19
|
export { rules, recommended };
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.recommended = exports.rules = void 0;
|
|
7
7
|
const gamut_import_paths_1 = __importDefault(require("./gamut-import-paths"));
|
|
8
8
|
const no_css_standalone_1 = __importDefault(require("./no-css-standalone"));
|
|
9
|
+
const no_inline_style_1 = __importDefault(require("./no-inline-style"));
|
|
10
|
+
const no_kbd_element_1 = __importDefault(require("./no-kbd-element"));
|
|
9
11
|
const prefer_themed_1 = __importDefault(require("./prefer-themed"));
|
|
10
12
|
const recommended_1 = __importDefault(require("./recommended"));
|
|
11
13
|
exports.recommended = recommended_1.default;
|
|
12
14
|
const rules = {
|
|
13
15
|
'import-paths': gamut_import_paths_1.default,
|
|
14
16
|
'no-css-standalone': no_css_standalone_1.default,
|
|
17
|
+
'no-inline-style': no_inline_style_1.default,
|
|
18
|
+
'no-kbd-element': no_kbd_element_1.default,
|
|
15
19
|
'prefer-themed': prefer_themed_1.default,
|
|
16
20
|
};
|
|
17
21
|
exports.rules = rules;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;AAAA,8EAAoD;AACpD,4EAAkD;AAClD,oEAA2C;AAC3C,gEAAwC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;AAAA,8EAAoD;AACpD,4EAAkD;AAClD,wEAA8C;AAC9C,sEAA4C;AAC5C,oEAA2C;AAC3C,gEAAwC;AAUxB,sBAVT,qBAAW,CAUS;AAR3B,MAAM,KAAK,GAAG;IACZ,cAAc,EAAE,4BAAgB;IAChC,mBAAmB,EAAE,2BAAe;IACpC,iBAAiB,EAAE,yBAAa;IAChC,gBAAgB,EAAE,wBAAY;IAC9B,eAAe,EAAE,uBAAY;CAC9B,CAAC;AAEO,sBAAK"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"noCssStandalone", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener> & {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
4
|
export default _default;
|
|
@@ -16,10 +16,9 @@ exports.default = (0, createRule_1.createRule)({
|
|
|
16
16
|
meta: {
|
|
17
17
|
docs: {
|
|
18
18
|
description: 'Ensure no standalone .css or .scss files.',
|
|
19
|
-
recommended: 'error',
|
|
20
19
|
},
|
|
21
20
|
messages: {
|
|
22
|
-
noCssStandalone: "
|
|
21
|
+
noCssStandalone: "Do not create anymore stylesheets, please see Gamut's Storybook documentation for current best practices.",
|
|
23
22
|
},
|
|
24
23
|
type: 'suggestion',
|
|
25
24
|
schema: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-css-standalone.js","sourceRoot":"","sources":["../src/no-css-standalone.ts"],"names":[],"mappings":";;AAAA,6CAA0C;AAE1C,kBAAe,IAAA,uBAAU,EAAC;IACxB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,8CAA8C,EAAE,UAAU,IAAI;gBAC5D,OAAO,CAAC,MAAM,CAAC;oBACb,SAAS,EAAE,iBAAiB;oBAC5B,IAAI;iBACL,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,2CAA2C;
|
|
1
|
+
{"version":3,"file":"no-css-standalone.js","sourceRoot":"","sources":["../src/no-css-standalone.ts"],"names":[],"mappings":";;AAAA,6CAA0C;AAE1C,kBAAe,IAAA,uBAAU,EAAC;IACxB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,8CAA8C,EAAE,UAAU,IAAI;gBAC5D,OAAO,CAAC,MAAM,CAAC;oBACb,SAAS,EAAE,iBAAiB;oBAC5B,IAAI;iBACL,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,2CAA2C;SACzD;QACD,QAAQ,EAAE;YACR,eAAe,EACb,2GAA2G;SAC9G;QACD,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,EAAE;KACX;IACD,IAAI,EAAE,mBAAmB;CAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
4
|
+
const createRule_1 = require("./createRule");
|
|
5
|
+
exports.default = (0, createRule_1.createRule)({
|
|
6
|
+
create(context) {
|
|
7
|
+
return {
|
|
8
|
+
JSXAttribute(node) {
|
|
9
|
+
if (node.name.type === utils_1.AST_NODE_TYPES.JSXIdentifier &&
|
|
10
|
+
node.name.name === 'style') {
|
|
11
|
+
context.report({
|
|
12
|
+
messageId: 'noInlineStyle',
|
|
13
|
+
node,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
defaultOptions: [],
|
|
20
|
+
meta: {
|
|
21
|
+
docs: {
|
|
22
|
+
description: 'Disallow inline style props on JSX elements.',
|
|
23
|
+
},
|
|
24
|
+
messages: {
|
|
25
|
+
noInlineStyle: 'The use of inline styles is discouraged — consider using styled components, design system utilities, or CSS classes instead.',
|
|
26
|
+
},
|
|
27
|
+
type: 'suggestion',
|
|
28
|
+
schema: [],
|
|
29
|
+
},
|
|
30
|
+
name: 'no-inline-style',
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=no-inline-style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-inline-style.js","sourceRoot":"","sources":["../src/no-inline-style.ts"],"names":[],"mappings":";;AAAA,oDAA0D;AAE1D,6CAA0C;AAE1C,kBAAe,IAAA,uBAAU,EAAC;IACxB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,YAAY,CAAC,IAAI;gBACf,IACE,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,aAAa;oBAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAC1B,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,eAAe;wBAC1B,IAAI;qBACL,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;SAC5D;QACD,QAAQ,EAAE;YACR,aAAa,EACX,8HAA8H;SACjI;QACD,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,EAAE;KACX;IACD,IAAI,EAAE,iBAAiB;CACxB,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
4
|
+
const createRule_1 = require("./createRule");
|
|
5
|
+
exports.default = (0, createRule_1.createRule)({
|
|
6
|
+
create(context) {
|
|
7
|
+
return {
|
|
8
|
+
JSXOpeningElement(node) {
|
|
9
|
+
if (node.name.type === utils_1.AST_NODE_TYPES.JSXIdentifier &&
|
|
10
|
+
node.name.name === 'kbd') {
|
|
11
|
+
context.report({
|
|
12
|
+
messageId: 'noKbdElement',
|
|
13
|
+
node,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
defaultOptions: [],
|
|
20
|
+
meta: {
|
|
21
|
+
docs: {
|
|
22
|
+
description: 'Intended to be used in Storybook docs to disallow use of the `kbd` HTML element in favor of the `KeyboardKey` component for styling purposes.',
|
|
23
|
+
},
|
|
24
|
+
messages: {
|
|
25
|
+
noKbdElement: 'Please use the `KeyboardKey` component instead.',
|
|
26
|
+
},
|
|
27
|
+
type: 'suggestion',
|
|
28
|
+
schema: [],
|
|
29
|
+
},
|
|
30
|
+
name: 'no-kbd-element',
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=no-kbd-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-kbd-element.js","sourceRoot":"","sources":["../src/no-kbd-element.ts"],"names":[],"mappings":";;AAAA,oDAA0D;AAE1D,6CAA0C;AAE1C,kBAAe,IAAA,uBAAU,EAAC;IACxB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,iBAAiB,CAAC,IAAI;gBACpB,IACE,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,aAAa;oBAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,EACxB,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,cAAc;wBACzB,IAAI;qBACL,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EACT,+IAA+I;SAClJ;QACD,QAAQ,EAAE;YACR,YAAY,EAAE,iDAAiD;SAChE;QACD,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,EAAE;KACX;IACD,IAAI,EAAE,gBAAgB;CACvB,CAAC,CAAC"}
|
package/dist/prefer-themed.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"preferThemed", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener> & {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
4
|
export default _default;
|
package/dist/prefer-themed.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("@typescript-eslint/utils");
|
|
4
3
|
const createRule_1 = require("./createRule");
|
|
5
|
-
const
|
|
4
|
+
const utils_1 = require("./utils");
|
|
6
5
|
exports.default = (0, createRule_1.createRule)({
|
|
7
6
|
create(context) {
|
|
8
7
|
return {
|
|
9
8
|
TaggedTemplateExpression(node) {
|
|
10
|
-
|
|
9
|
+
/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison -- @typescript-eslint/types use string enums; literals match ESTree */
|
|
10
|
+
if (node.tag.type === 'MemberExpression') {
|
|
11
11
|
if (node.tag.object.type !== 'Identifier')
|
|
12
12
|
return;
|
|
13
13
|
const expressionVariable = node.tag.object.name;
|
|
14
14
|
const arrowFuncExpression = node.quasi.expressions[0];
|
|
15
|
-
if (arrowFuncExpression?.type !==
|
|
15
|
+
if (arrowFuncExpression?.type !== 'ArrowFunctionExpression')
|
|
16
16
|
return;
|
|
17
|
-
|
|
17
|
+
/* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
|
|
18
|
+
if (!(0, utils_1.isNamedVariableTheme)(arrowFuncExpression))
|
|
18
19
|
return;
|
|
19
20
|
if (expressionVariable === 'styled') {
|
|
20
|
-
const { themeValueKey, themeCategory } = (0,
|
|
21
|
+
const { themeValueKey, themeCategory } = (0, utils_1.checkArrowFuncBodyTypesAndReturnThemeVars)(arrowFuncExpression) ||
|
|
21
22
|
{};
|
|
22
23
|
if (!themeValueKey)
|
|
23
24
|
return;
|
|
@@ -37,11 +38,10 @@ exports.default = (0, createRule_1.createRule)({
|
|
|
37
38
|
meta: {
|
|
38
39
|
docs: {
|
|
39
40
|
description: 'Prefer themed style utility',
|
|
40
|
-
recommended: 'error',
|
|
41
41
|
},
|
|
42
42
|
fixable: 'code',
|
|
43
43
|
messages: {
|
|
44
|
-
preferThemed: 'Use the themed style utility
|
|
44
|
+
preferThemed: 'Use the our variants API or themed style utility from gamut-styles instead.',
|
|
45
45
|
},
|
|
46
46
|
type: 'suggestion',
|
|
47
47
|
schema: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-themed.js","sourceRoot":"","sources":["../src/prefer-themed.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"prefer-themed.js","sourceRoot":"","sources":["../src/prefer-themed.ts"],"names":[],"mappings":";;AAAA,6CAA0C;AAC1C,mCAGiB;AAEjB,kBAAe,IAAA,uBAAU,EAAC;IACxB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,wBAAwB,CAAC,IAAI;gBAC3B,qIAAqI;gBACrI,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;oBACzC,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY;wBAAE,OAAO;oBAClD,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;oBAChD,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;oBAEtD,IAAI,mBAAmB,EAAE,IAAI,KAAK,yBAAyB;wBAAE,OAAO;oBACpE,gEAAgE;oBAEhE,IAAI,CAAC,IAAA,4BAAoB,EAAC,mBAAmB,CAAC;wBAAE,OAAO;oBAEvD,IAAI,kBAAkB,KAAK,QAAQ,EAAE,CAAC;wBACpC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GACpC,IAAA,iDAAyC,EAAC,mBAAmB,CAAC;4BAC9D,EAAE,CAAC;wBAEL,IAAI,CAAC,aAAa;4BAAE,OAAO;wBAE3B,OAAO,CAAC,MAAM,CAAC;4BACb,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,OAAO,KAAK,CAAC,WAAW,CACtB,mBAAmB,EACnB,WAAW,aAAa,IAAI,aAAa,IAAI,CAC9C,CAAC;4BACJ,CAAC;4BACD,SAAS,EAAE,cAAc;4BACzB,IAAI;yBACL,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,6BAA6B;SAC3C;QACD,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE;YACR,YAAY,EACV,6EAA6E;SAChF;QACD,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,EAAE;KACX;IACD,IAAI,EAAE,eAAe;CACtB,CAAC,CAAC"}
|
package/dist/recommended.d.ts
CHANGED
package/dist/recommended.js
CHANGED
package/dist/recommended.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommended.js","sourceRoot":"","sources":["../src/recommended.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,KAAK,EAAE;QACL,yBAAyB,EAAE,OAAO;QAClC,qBAAqB,EAAE,KAAK;QAC5B,0BAA0B,EAAE,OAAO;KACpC;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"recommended.js","sourceRoot":"","sources":["../src/recommended.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,KAAK,EAAE;QACL,yBAAyB,EAAE,OAAO;QAClC,uBAAuB,EAAE,OAAO;QAChC,qBAAqB,EAAE,KAAK;QAC5B,0BAA0B,EAAE,OAAO;KACpC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"name": "eslint-plugin-gamut",
|
|
3
3
|
"description": "Shared eslint plugin for Gamut applications",
|
|
4
|
+
"version": "3.1.0",
|
|
5
|
+
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@typescript-eslint/utils": "^8.57.0"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
4
12
|
"keywords": [
|
|
5
|
-
"gamut",
|
|
6
13
|
"eslint",
|
|
7
|
-
"
|
|
8
|
-
"gamut-styles"
|
|
14
|
+
"gamut",
|
|
15
|
+
"gamut-styles",
|
|
16
|
+
"styles"
|
|
9
17
|
],
|
|
10
|
-
"name": "eslint-plugin-gamut",
|
|
11
|
-
"version": "3.0.3-alpha.f96830.0",
|
|
12
18
|
"license": "MIT",
|
|
13
19
|
"main": "./dist/index.js",
|
|
14
20
|
"module": "dist/index.js",
|
|
15
21
|
"publishConfig": {
|
|
16
22
|
"access": "public"
|
|
17
23
|
},
|
|
18
|
-
"repository":
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/Codecademy/gamut.git"
|
|
21
|
-
},
|
|
24
|
+
"repository": "Codecademy/gamut.git",
|
|
22
25
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"build:clean": "rm -rf dist",
|
|
26
|
-
"build": "yarn build:clean && yarn build:compile",
|
|
27
|
-
"lernaBuildTask": "yarn build"
|
|
28
|
-
},
|
|
29
|
-
"types": "./dist/index.d.ts",
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@typescript-eslint/utils": "^5.15.0"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/eslint": "^8.4.1",
|
|
35
|
-
"eslint": "^8.11.0"
|
|
26
|
+
"build": "nx build eslint-plugin-gamut",
|
|
27
|
+
"verify": "tsc --noEmit"
|
|
36
28
|
},
|
|
37
|
-
"
|
|
29
|
+
"types": "./dist/index.d.ts"
|
|
38
30
|
}
|
package/.turbo/turbo-build.log
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
### 3.0.3-alpha.f96830.0 (2022-03-18)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package eslint-plugin-gamut
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2016 Ryzac, Inc.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
const utils_1 = require("@typescript-eslint/utils");
|
|
7
|
-
const no_css_standalone_1 = __importDefault(require("./no-css-standalone"));
|
|
8
|
-
const ruleTester = new utils_1.ESLintUtils.RuleTester({
|
|
9
|
-
parser: '@typescript-eslint/parser',
|
|
10
|
-
});
|
|
11
|
-
ruleTester.run('no-css-standalone', no_css_standalone_1.default, {
|
|
12
|
-
valid: [
|
|
13
|
-
``,
|
|
14
|
-
`import {namedImport} from 'fileName.tsx'`,
|
|
15
|
-
`import {namedImport} from 'fileName.ts'`,
|
|
16
|
-
`import {namedImport} from 'fileName.js'`,
|
|
17
|
-
`import {namedImport} from 'fileName.yml'`,
|
|
18
|
-
`import {namedImport} from 'fileName.json'`,
|
|
19
|
-
`import {namedImport} from 'fileName.md'`,
|
|
20
|
-
`import {namedImport} from 'fileName.mdx'`,
|
|
21
|
-
`import defaultImport from 'fileName.svg'`,
|
|
22
|
-
`import defaultImport from 'fileName.ts'`,
|
|
23
|
-
`import defaultImport from 'fileName.tsx'`,
|
|
24
|
-
`import defaultImport from 'fileName.js'`,
|
|
25
|
-
`import defaultImport from 'fileName.yml'`,
|
|
26
|
-
`import defaultImport from 'fileName.json'`,
|
|
27
|
-
`import defaultImport from 'fileName.md'`,
|
|
28
|
-
`import defaultImport from 'fileName.mdx'`,
|
|
29
|
-
`import defaultImport from 'fileName.svg'`,
|
|
30
|
-
],
|
|
31
|
-
invalid: [
|
|
32
|
-
{
|
|
33
|
-
code: `import {namedImport} from 'fileName.css'`,
|
|
34
|
-
errors: [
|
|
35
|
-
{
|
|
36
|
-
messageId: 'noCssStandalone',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
code: `import {namedImport} from 'fileName.scss'`,
|
|
42
|
-
errors: [
|
|
43
|
-
{
|
|
44
|
-
messageId: 'noCssStandalone',
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
code: `import namedImport from 'fileName.css'`,
|
|
50
|
-
errors: [
|
|
51
|
-
{
|
|
52
|
-
messageId: 'noCssStandalone',
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
code: `import namedImport from 'fileName.scss'`,
|
|
58
|
-
errors: [
|
|
59
|
-
{
|
|
60
|
-
messageId: 'noCssStandalone',
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
});
|
|
66
|
-
//# sourceMappingURL=no-css-standalone.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-css-standalone.test.js","sourceRoot":"","sources":["../src/no-css-standalone.test.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuD;AAEvD,4EAAuC;AAEvC,MAAM,UAAU,GAAG,IAAI,mBAAW,CAAC,UAAU,CAAC;IAC5C,MAAM,EAAE,2BAA2B;CACpC,CAAC,CAAC;AAEH,UAAU,CAAC,GAAG,CAAC,mBAAmB,EAAE,2BAAI,EAAE;IACxC,KAAK,EAAE;QACL,EAAE;QACF,0CAA0C;QAC1C,yCAAyC;QACzC,yCAAyC;QACzC,0CAA0C;QAC1C,2CAA2C;QAC3C,yCAAyC;QACzC,0CAA0C;QAC1C,0CAA0C;QAC1C,yCAAyC;QACzC,0CAA0C;QAC1C,yCAAyC;QACzC,0CAA0C;QAC1C,2CAA2C;QAC3C,yCAAyC;QACzC,0CAA0C;QAC1C,0CAA0C;KAC3C;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,0CAA0C;YAChD,MAAM,EAAE;gBACN;oBACE,SAAS,EAAE,iBAAiB;iBAC7B;aACF;SACF;QACD;YACE,IAAI,EAAE,2CAA2C;YACjD,MAAM,EAAE;gBACN;oBACE,SAAS,EAAE,iBAAiB;iBAC7B;aACF;SACF;QACD;YACE,IAAI,EAAE,wCAAwC;YAC9C,MAAM,EAAE;gBACN;oBACE,SAAS,EAAE,iBAAiB;iBAC7B;aACF;SACF;QACD;YACE,IAAI,EAAE,yCAAyC;YAC/C,MAAM,EAAE;gBACN;oBACE,SAAS,EAAE,iBAAiB;iBAC7B;aACF;SACF;KACF;CACF,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
const utils_1 = require("@typescript-eslint/utils");
|
|
7
|
-
const prefer_themed_1 = __importDefault(require("./prefer-themed"));
|
|
8
|
-
const ruleTester = new utils_1.ESLintUtils.RuleTester({
|
|
9
|
-
parser: '@typescript-eslint/parser',
|
|
10
|
-
});
|
|
11
|
-
ruleTester.run('prefer-themed', prefer_themed_1.default, {
|
|
12
|
-
valid: [
|
|
13
|
-
``,
|
|
14
|
-
`styled.div\`
|
|
15
|
-
color: \${themed('colors.wat')};
|
|
16
|
-
\``,
|
|
17
|
-
`styled(Box)\`
|
|
18
|
-
color: \${themed('colors.wat')};
|
|
19
|
-
\``,
|
|
20
|
-
`
|
|
21
|
-
export const AppWrapper = styled.div\`
|
|
22
|
-
position: relative;
|
|
23
|
-
z-index: 1;
|
|
24
|
-
\`;
|
|
25
|
-
`,
|
|
26
|
-
],
|
|
27
|
-
invalid: [
|
|
28
|
-
{
|
|
29
|
-
code: `styled.div\`
|
|
30
|
-
color: \${({ theme }) => theme.colors.wat};
|
|
31
|
-
\``,
|
|
32
|
-
errors: [
|
|
33
|
-
{
|
|
34
|
-
messageId: 'preferThemed',
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
output: `styled.div\`
|
|
38
|
-
color: \${themed('colors.wat')};
|
|
39
|
-
\``,
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
});
|
|
43
|
-
//# sourceMappingURL=prefer-themed.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-themed.test.js","sourceRoot":"","sources":["../src/prefer-themed.test.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuD;AAEvD,oEAAmC;AAEnC,MAAM,UAAU,GAAG,IAAI,mBAAW,CAAC,UAAU,CAAC;IAC5C,MAAM,EAAE,2BAA2B;CACpC,CAAC,CAAC;AAEH,UAAU,CAAC,GAAG,CAAC,eAAe,EAAE,uBAAI,EAAE;IACpC,KAAK,EAAE;QACL,EAAE;QACF;;GAED;QACC;;GAED;QACC;;;;;CAKH;KACE;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE;;GAET;YACG,MAAM,EAAE;gBACN;oBACE,SAAS,EAAE,cAAc;iBAC1B;aACF;YACD,MAAM,EAAE;;GAEX;SACE;KACF;CACF,CAAC,CAAC"}
|
package/jest.config.js
DELETED