Skip to content

Commit

Permalink
Split eslint-plugin-import rules into their own file
Browse files Browse the repository at this point in the history
  • Loading branch information
wyze committed Nov 7, 2016
1 parent a9268ab commit eede092
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
1 change: 1 addition & 0 deletions base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
'plugin:wyze/recommended',
'wyze/rules/best-practices',
'wyze/rules/es6',
'wyze/rules/import',
'wyze/rules/legacy',
'wyze/rules/style',
],
Expand Down
18 changes: 0 additions & 18 deletions rules/es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,6 @@ module.exports = {
rules: {
// require parens in arrow function arguments
'arrow-parens': [ 'error', 'as-needed' ],
// ensure default import coupled with default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
'import/default': 'error',
// disallow non-import statements appearing before import statements
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
'import/imports-first': [ 'error', '' ],
// ensure named imports coupled with named exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
'import/named': 'error',
// ensure new line after last import/require in group
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
'import/newline-after-import': 'error',
// disallow duplicate imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
'import/no-duplicates': 'error',
// Forbid the use of extraneous packages
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
'import/no-extraneous-dependencies': [ 'error', { devDependencies: true }],
// disallow arrow functions where they could be confused with comparisons
// http://eslint.org/docs/rules/no-confusing-arrow
'no-confusing-arrow': 'off',
Expand Down
22 changes: 22 additions & 0 deletions rules/import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
rules: {
// ensure default import coupled with default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
'import/default': 'error',
// disallow non-import statements appearing before import statements
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
'import/imports-first': [ 'error', '' ],
// ensure named imports coupled with named exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
'import/named': 'error',
// ensure new line after last import/require in group
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
'import/newline-after-import': 'error',
// disallow duplicate imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
'import/no-duplicates': 'error',
// Forbid the use of extraneous packages
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
'import/no-extraneous-dependencies': [ 'error', { devDependencies: true }],
},
}
8 changes: 8 additions & 0 deletions test/rules/import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { rules } from '../../rules/import'
import test from 'ava'

test('only import rules', t => {
Object.keys(rules).forEach(rule => {
t.truthy(~rule.indexOf('import/'))
})
})

0 comments on commit eede092

Please sign in to comment.