eslint-config-vtex
Version:
VTEX's eslint config
55 lines (46 loc) • 2.28 kB
JavaScript
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules
module.exports = {
extends: ['plugin:import/typescript'],
plugins: ['import'],
rules: {
// Disallow non-import statements appearing before import statements
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
'import/first': 'error',
// Disallow duplicate imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
'import/no-duplicates': 'error',
// Ensure native, external and internal imports are separated, above relative imports and that unassigned imports are ignored
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
// todo: add import-type to this, waiting for https://github.com/benmosher/eslint-plugin-import/issues/645
'import/order': [
'error',
{
'newlines-between': 'always',
groups: [
'builtin',
'external',
'internal',
['parent', 'sibling', 'index'],
],
},
],
// Require a newline after the last import/require in a group
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
'import/newline-after-import': 'error',
// Forbid import of modules using absolute paths
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
'import/no-absolute-path': 'error',
// Forbid mutable exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
'import/no-mutable-exports': 'error',
// Disallow invalid exports, e.g. multiple defaults
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
'import/export': 'error',
// Ensures that there are no useless path segments
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-useless-path-segments.md
'import/no-useless-path-segments': ['error', { commonjs: true }],
// Forbid a module from importing itself
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-self-import.md
'import/no-self-import': 'error',
},
}