Skip to content

Commit

Permalink
Fix: Fix import and continue rule definitions ✨
Browse files Browse the repository at this point in the history
This "fixes" a few of the Airbnb rule values that I would argue are totally fine. Using continue
makes sense in some cases, and files with only named exports is a great practice for utility
modules.

Closes #70, Closes #71
  • Loading branch information
DHedgecock committed Jul 12, 2019
1 parent c870732 commit 797b286
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
7 changes: 1 addition & 6 deletions src/rules/core-stylistic-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ module.exports = {

// disallow use of the continue statement
// https://eslint.org/docs/rules/no-continue
'no-continue': 'error',
'no-continue': 'off',

// disallow comments inline after code
'no-inline-comments': 'off',
Expand Down Expand Up @@ -244,11 +244,6 @@ module.exports = {
message:
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'ForOfStatement',
message:
'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
},
{
selector: 'LabeledStatement',
message:
Expand Down
13 changes: 7 additions & 6 deletions src/rules/imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ module.exports = {
'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],

// 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
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md
'import/named': 'error',

// 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
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md
'import/default': 'off',

// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
Expand Down Expand Up @@ -145,9 +145,10 @@ module.exports = {
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
'import/newline-after-import': 'error',

// Require modules with a single export to use a default export
// Using named exports is a good practice for ensuring consistency across the codebase
// so this rule is off
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
'import/prefer-default-export': 'error',
'import/prefer-default-export': 'off',

// Restrict which files can be imported in a given folder
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
Expand Down Expand Up @@ -197,7 +198,7 @@ module.exports = {
// Reports if a module's default export is unnamed
// https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
'import/no-anonymous-default-export': [
'off',
'error',
{
allowArray: false,
allowArrowFunction: false,
Expand All @@ -219,7 +220,7 @@ module.exports = {
// https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
'import/group-exports': 'off',

// forbid default exports. this is a terrible rule, do not use it.
// Default exports are ok!
// https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
'import/no-default-export': 'off',

Expand Down

0 comments on commit 797b286

Please sign in to comment.