@atlaskit/eslint-plugin-ui-styling-standard
Version:
The eslint plugin to enforce and educate on Atlassian's UI Styling Standard
34 lines (33 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createRule = require("../utils/create-rule");
var rule = (0, _createRule.createLintRule)({
meta: {
name: 'no-atlaskit-theme',
docs: {
description: 'Disallow imports from `@atlaskit/theme`',
recommended: true,
severity: 'error'
},
messages: {
'no-atlaskit-theme': "Replace @atlaskit/theme imports with semantic token() values from @atlaskit/tokens or the matching ADS component; migrate each imported helper before removing the import."
},
type: 'problem'
},
create: function create(context) {
return {
// esquery regexes cannot contain a raw `/`, so the path separator is `\x2F`.
// Unanchored at the end, so this matches `@atlaskit/theme` and any subpath.
'ImportDeclaration[source.value=/^@atlaskit\\x2Ftheme(\\x2F|$)/]': function ImportDeclarationSourceValue_AtlaskitX2FthemeX2F$_(node) {
context.report({
node: node,
messageId: 'no-atlaskit-theme'
});
}
};
}
});
var _default = exports.default = rule;