Skip to content
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

RFC: Remove vars follow up #11783

Closed
blling opened this issue Dec 6, 2017 · 11 comments
Closed

RFC: Remove vars follow up #11783

blling opened this issue Dec 6, 2017 · 11 comments

Comments

@blling
Copy link

blling commented Dec 6, 2017

Most of the var has been removed after the PR #11780(thanks @raphamorim again) merged, so we could lint against developers use var again, but this is a bit tricky because some files have to use var. we should have a way to override lint configuration for a subset of the files, so we should discuss the solutions here.

@gaearon
Copy link
Collaborator

gaearon commented Dec 6, 2017

For Prettier, we have separate configurations for files that should be ES5 and ES6. We need to extract these paths to a shared config, and then split the ESLint task into two runs, one of them would assume the code is ES5 and another, ES6.

@davscro
Copy link

davscro commented Dec 6, 2017

hi @gaearon
could we write custom eslint preprocessor and for "var" files (~40) override 'no-var'
rule?

@gaearon
Copy link
Collaborator

gaearon commented Dec 6, 2017

Here's how we separate configs for Prettier. Since we now call ESLint through its Node API too, I imagine we would use a similar strategy there. Divide it into two calls, and override rules for one of the calls.

@ctxhou
Copy link
Contributor

ctxhou commented Dec 6, 2017

Hi @gaearon, I want to work on this.
Can you give me some instructions? Like what kind of file we will permit to use var?

@gaearon
Copy link
Collaborator

gaearon commented Dec 6, 2017

These are files that need to use ES5 (and thus var).

These are files that should use ES6 only.

Does that help?

@ctxhou
Copy link
Contributor

ctxhou commented Dec 6, 2017

Ok thanks, it helps!

@blling
Copy link
Author

blling commented Dec 7, 2017

@ctxhou i think this should be done as fast as you can, otherwise vars will be add again.

@ctxhou
Copy link
Contributor

ctxhou commented Dec 7, 2017

There is one thing I want to discuss.
Currently, these is prettier es6 files pattern:

[
   // Internal forwarding modules
   'packages/*/*.js',
   // Source files
   'packages/*/src/**/*.js',
   'packages/shared/**/*.js',
 ]

But for eslint, the es6 lint pattern should be all js files without es5 files?
So it means that the shared es6 pattern will not be the same with prettier and eslint config.
Is it correct?

@gaearon
Copy link
Collaborator

gaearon commented Dec 7, 2017

I don’t understand why it would be different. Those are ES6 files. The ES5 files are listed separately below.

@ctxhou
Copy link
Contributor

ctxhou commented Dec 7, 2017

Sorry, I misunderstand the pattern.
Here I create a pr to fix this issue: #11794

@gaearon
Copy link
Collaborator

gaearon commented Dec 11, 2017

Fixed in #11794.

@gaearon gaearon closed this as completed Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants