@atlaskit/eslint-plugin-ui-styling-standard
Version:
The eslint plugin to enforce and educate on Atlassian's UI Styling Standard
28 lines • 1 kB
JavaScript
import { createLintRule } from '../utils/create-rule';
var rule = 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'
});
}
};
}
});
export default rule;