-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidating strict
rule definition between airbnb and airbnb-base
#1582
Comments
strict
rule definition between eslint-config-airbnb and eslint-config-airbnb-basestrict
rule definition between airbnb and airbnb-base
Any thoughts before I open the PR? :-) |
I believe it is intentional as-is. When using babel, every file is a module, and thus auto-strict - so you never should use a "use strict" directive. When not using babel, you should have the directive everywhere. When using the base config, it's much more likely that someone might not be using babel (since they won't be using jsx). (Also, |
True, but from the OP:
...so even people using base already have module mode enabled. |
That is true - hmm. OK, so, here's the changes I think should be made:
A PR that does the base and main changes each in one commit (commit message convention: |
Since the file is now imported in base instead. Fixes airbnb#1582.
Sorry for the delay; have opened #1962 :-) |
Since the file is now imported in base instead. Fixes airbnb#1582.
Since the file is now imported in base instead. Fixes airbnb#1582.
Since the file is now imported in base instead. Fixes airbnb#1582.
@ljharb said
Which is true. I use the base config and was surprised to see But this made me realize that the airbnb style guide
So I get the idea it shouldn't really be used for Node.js and am thus going to switch to something else for that. Posting here so you guys are aware of this part of your user base 😄 |
Since the file is now imported in base instead. Fixes airbnb#1582.
Since the file is now imported in base instead. Fixes airbnb#1582.
Hi!
I've spotted some inconsistency/duplication with the
strict
rule and wondered if this was intentional?Currently:
strict: ['error', 'never']
.eslint-config-airbnb
and noteslint-config-airbnb-base
.eslint-config-airbnb-base
setsstrict: 'error'
manually in its rules directive (which results in the ESLint default ofstrict: ['error', 'safe']
).eslint-config-airbnb-base
andeslint-config-airbnb
setsourceType: 'module'
, which causes the ESLint strict rule to "disallow[s] strict mode directives, no matter which option is specified" regardless of those options - ie:strict: ['error', 'never']
(docs).Issues:
eslint-config-airbnb-base
rather thaneslint-config-airbnb
, but yet theeslint-config-airbnb-base/rules/strict
extends
is contrary to that, and confusing to the end user if it actually resulted in different strict mode behaviour.sourceType: 'module'
, botheslint-config-airbnb-base
andeslint-config-airbnb
actually result in the same strict mode behaviour (ie: equivalent ofstrict: ['error', 'never']
) anyway, so in most cases the rule being listed twice is just duplication rather than having any effect.I think this situation might just be an accidental leftover from the split to the airbnb-base package (see here) and then #637.
As such, to increase consistency I would like to propose:
eslint-config-airbnb-base/rules/strict
fromeslint-config-airbnb
'sextends
toeslint-config-airbnb-base
's (this won't affect legacy).strict
rule definition fromeslint-config-airbnb-base
'srules
.eslint-config-airbnb-base
major version in case there's anyone using it who setssourceType: 'script'
manually rather than using legacy, since they would see a difference in behaviour.If this sounds acceptable, I'm happy to open a PR :-)
The text was updated successfully, but these errors were encountered: