I did consider doing something like this (our build is bash-based, but the 
principle is simple enough).

However, this breaks the nice SublimeLinter integration, as that tool only 
knows about the .eslintrc files.

Having thought about this some more, I think my best approach is to write a 
rule for our project which allows me to blacklist nodes by file extension.

The rule can just run on every file, and if it sees an ES6 feature, but the 
filename doesn't meet whatever criteria we have, it'll error.

Cheers
Glen

On Wednesday, 4 March 2015 20:51:05 UTC, Jamund Ferguson wrote:
>
> FWIW I do this at PayPal with grunt-eslint (but any tool till do). Just 
> have diff files `.eslintrc` files (which can still cascade) that get pulled 
> in for different file paths. Our config looks something like this:
>
> module.exports = {
>    options: {
>       config: '.eslintrc'
>    },
>    server: serverJS,
>    browser: {
>       options: {
>          config: 'public/js/.eslintrc'
>       },
>       src: browserJS
>    },
>    es6: {
>       options: {
>          config: 'public/js/.eslintes6rc'
>       },
>       src: ES6JS
>    },
>    test: {
>       options: {
>          config: 'tests/.eslintrc'
>       },
>       src: testJS
>    }
> };
>
>
> For example the ES6JS variable is just like this:
>
> var ES6JS = [
>    'public/js/**/*.es6'
> ];
>
>
> Probably you could do the same thing on the command line with commands 
> like:
> find . -name *.es6 | xargs eslint -c .eslintes6rc 
>
> Of course we're using a mix of diff folders and diff extensions to pull 
> this off ;)
>
> On Friday, February 27, 2015 at 5:54:31 AM UTC-8, Glen Mailer wrote:
>>
>> Hello,
>>
>> I've been looking for a way to combine linting and JSX / ES6 files within 
>> a large project.
>>
>> The project has a number of separate applications within it, where each 
>> has it's own package.json - but the linting rules are applied globally.
>>
>> We have eslint set up to lint all *.js files, and jsxhint does all *.jsx 
>> files.
>>
>> I've been trying out the preview release of 
>> https://github.com/babel/babel-eslint just now - and it looks like this 
>> makes eslint's ES6 support wide enough to be the one linter that can do our 
>> whole codebase \o/.
>>
>> However, there's a slight complication. We want to have a single set of 
>> rules across all projects - but there are a few different contexts that our 
>> code runs in:
>>
>>    1. Non-ES6 JS for node
>>    2. Babel-compiled ES6 JS for node
>>    3. Non-ES6 JS for the browser
>>    4. Babel-compiled JSX for the browser
>>
>> The reason these different contexts exist is due to the way the build 
>> tools are set up, ES6 features are opt-in by naming the file *.jsx
>>
>> Ideally I'd want to configure use of ES6 features to be an error in *.js 
>> files, but allowed in *.jsx files - but JSX elements to only be allowed in 
>> client-side code.
>>
>> Is there a way to get eslint to interpret different files across the same 
>> project with different rules?
>>
>> I hope that makes sense - I've tried to provide as much context for the 
>> setup as I could!
>>
>>
>> Cheers
>>
>> Glen
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to