UNPKG

@atlaskit/eslint-plugin-ui-styling-standard

Version:

The eslint plugin to enforce and educate on Atlassian's UI Styling Standard

33 lines • 1.07 kB
import { createNoExportedRule } from '@atlaskit/eslint-utils/create-no-exported-rule'; import { isCss, isCssMap, isKeyframes, isStyled, isXcss } from '@atlaskit/eslint-utils/is-supported-import'; import { createLintRule } from '../utils/create-rule'; const schema = [{ type: 'object', properties: { importSources: { type: 'array', items: { type: 'string' }, uniqueItems: true } } }]; const supportedImports = [isCss, isCssMap, isKeyframes, isXcss, isStyled]; const rule = createLintRule({ meta: { name: 'no-exported-styles', docs: { description: 'Disallows exports of css, keyframes, styled and xcss', recommended: true, severity: 'error' }, messages: { 'no-exported-styles': "Keep css, cssMap, keyframes, styled and xcss declarations in the file that uses them. Export a component to share its styling instead of exporting style values." }, type: 'problem', schema }, create: createNoExportedRule(supportedImports, 'no-exported-styles') }); export default rule;