How do I setup a folder with a different rule and another folder with a different rule How do I setup a folder with a different rule and another folder with a different rule angularjs angularjs

How do I setup a folder with a different rule and another folder with a different rule


Configuration for client and server code

If you wonder how to lint different part of code, this is a suggestion.

- myproject--- .eslintrc--- src------ client--------- .eslintrc ------ server--------- .eslintrc

myproject/.eslintrc contains the common rules. For instance,

rules:    brace-style: [2, "1tbs"]    comma-style: [2, "last"]    default-case: 2    func-style: [2, "declaration"] ...

src/client/.eslintrc contains client side rules. For instance,

env:    browser: trueglobals:    angular: falseplugins:  - angular

src/server/.eslintrc contains server side rules. For instance

env:    node: true

Usually I lint a javascript file when I save it.

ESLint is installed also globally. As stated in config help page of ESLint, a globally-installed instance of ESLint can only use globally-installed ESLint plugins. A locally-installed ESLint can make sure of both locally- and globally- installed ESLint plugins. That's I need to install also globally the plugin.


I would suggest to use two configs and two tasks:

eslint -c .eslintrc-client.json client

eslint -c .eslintrc-server.json server models