-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
/** | ||
* - adds `.jsx` as an extension | ||
* Adds `.jsx` as an extension, and enables JSX parsing. | ||
* | ||
* Even if _you_ aren't using JSX (or .jsx) directly, if your dependencies | ||
* define jsnext:main and have JSX internally, you may run into problems | ||
* if you don't enable these settings at the top level. | ||
*/ | ||
module.exports = { | ||
|
||
settings: { | ||
'import/extensions': ['.js', '.jsx'], | ||
}, | ||
|
||
parserOptions: { | ||
ecmaFeatures: { jsx: true }, | ||
}, | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* The basics. | ||
* @type {Object} | ||
*/ | ||
module.exports = { | ||
rules: { | ||
// analysis/correctness | ||
'import/no-unresolved': 'error', | ||
'import/named': 'error', | ||
'import/namespace': 'error', | ||
'import/default': 'error', | ||
'import/export': 'error', | ||
|
||
// red flags (thus, warnings) | ||
'import/no-named-as-default': 'warn', | ||
'import/no-named-as-default-member': 'warn', | ||
'import/no-duplicates': 'warn', | ||
This comment has been minimized.
Sorry, something went wrong. |
||
}, | ||
|
||
// need all these for parsing dependencies (even if _your_ code doesn't need | ||
// all of them) | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 6, | ||
ecmaFeatures: { experimentalObjectRestSpread: true }, | ||
}, | ||
} |
2 comments
on commit a55cd67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just changed the way I created the recommended config in one of my plugins. I now put them all in the rule meta docs field, then loop over each. jfmengels/eslint-plugin-lodash-fp@97a04ab I think I'll use something like this in my other plugins too. I have tests that make sure that all rules appear in the recommended config.
The same system could be adapted to create multiple configs (recommended, errors, warnings...) should you want it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, super cool idea! I am torn a little, because I like being able to put relevant comments in the config source, and that gets lost if it comes from the meta... but then again, then the docs can automagically keep up with the shared states of the rule ("This rule is included with:"...)
I will mull it over. It's probably a good time, since a major version is nigh.
I find that warnings achieve very little and rarely put warnings in recommended configurations.
Sure, having duplicates for instance will not create errors, but in the context of ESLint settings, that would warrant an error level IMO. It is pretty easy to override, so I wouldn't let that hinder having them be errors.
I would also specify every rule, even if just to set it to
off
. That makes it easier to copy-paste all the rules for those who would prefer to do it that way.