@esscorp/eslint v2.7.3
Eslint Configuration
https://www.npmjs.com/package/@esscorp/eslint
Usage
To use this npm module:
- Install
- Configure Grunt
- (Optional) Configure Visual Studio Code
- (Optional) Configure Atom
- (Optional) Configure Sublime Text
Install
npm install --save @esscorp/eslint;
Configure Grunt
Install grunt-eslint.
npm install --save-dev grunt-eslint;
Create a new file in the grunt tasks folder (e.g.
grunts/eslint.js
) with this content:'use strict';
module.exports = function(grunt) {
grunt.config('eslint', {
options: {
rulePaths: ['node_modules/@esscorp/eslint/rules']
},
backend: {
options: {
configFile: 'node_modules/@esscorp/eslint/configs/backend.js'
},
src: [
'*.js',
'grunts/**/*.js',
// <file-patterns-here>
]
},
frontend: {
options: {
configFile: 'node_modules/@esscorp/eslint/configs/frontend.js'
},
src: [
// <file-patterns-here>
]
}
});
grunt.loadNpmTasks('grunt-eslint');
};
```
Fill out
<file-patterns-here>
in thebackend.src
andfrontend.src
arrays. (additional info here)Update
gruntfile.js
to include this configuration:'use strict'; var Pkg = require('./package.json');
module.exports = function(grunt) {
grunt.initConfig({
pkg: Pkg
});
grunt.loadTasks('grunts');
grunt.registerTask('check', [
'eslint'
]);
grunt.registerTask('lint', [
'eslint'
]);
grunt.registerTask('build', [
'check'
//additional tasks here
]);
grunt.registerTask('default', [
'check'
]);
};
```
- Test with
grunt
andgrunt lint
.
Configure Visual Studio Code
NOTE: This is optional.
Open
Settings
.- OS X: ⌘,
- Linux: CTRL,
Add to
USER SETTINGS
:"eslint.autoFixOnSave": true, "eslint.options": { "rulePaths": [ "node_modules/@esscorp/eslint/rules" ] },
Create
.eslintrc.js
in the top-level directory of the repo (next topackage.json
) with this content:'use strict';
module.exports = require('@esscorp/eslint').configs.backend;
```
- Create another
.eslintrc.js
in the directory containing frontend files (e.g.,public/.eslintrc.js
) with this content:'use strict';
module.exports = require('@esscorp/eslint').configs.frontend;
```
Configure Atom
NOTE: This is optional.
Open
Settings
.- OS X: ⌘,
- Linux: CTRL,
Go to
Install
.Search for and install
linter
.Search for and install
linter-eslint
.Configure
linter-eslint
.- Click
Settings
button underlinter-eslint
. - Set
ESLint Rules Dir
tonode_modules/@esscorp/eslint/rules
- Set
.eslintrc Path
tonode_modules/@esscorp/eslint/configs/backend.js
- Click
Create
.eslintrc.js
in the top-level directory of the repo (next topackage.json
) with this content:'use strict';
module.exports = require('@esscorp/eslint').configs.backend;
```
- Create another
.eslintrc.js
in the directory containing frontend files (e.g.,public/.eslintrc.js
) with this content:'use strict';
module.exports = require('@esscorp/eslint').configs.frontend;
```
Configure Sublime Text
NOTE: This is optional.
Install Package Control if it is not installed already.
Install
ESLint
.- Open
Package Control
.- OS X: ⌘⇧P
- Linux: CTRLSHIFTP
- Search for and select
Package Control: Install Package
. - Search for and select
ESLint
.
- Open
Install
SublimeLinter-contrib-eslint
.- Open
Package Control
.- OS X: ⌘⇧P
- Linux: CTRLSHIFTP
- Search for and select
Package Control: Install Package
. - Search for and select
SublimeLinter-contrib-eslint
.
- Open
Configure
SublimeLinter-contrib-eslint
.- In the menu, navigate to
Preferences
>Package Settings
>SublimeLinter
>Settings - User
- Add or insert this content:
{ "user": { "linters": { "eslint": { "@disable": false, "args": ["--rulesdir", "node_modules/@esscorp/eslint/rules"], "excludes": [ "**/node_modules/**" ] } } } }
- In the menu, navigate to
Create
.eslintrc.js
in the top-level directory of the repo (next topackage.json
) with this content:'use strict';
module.exports = require('@esscorp/eslint').configs.backend;
```
- Create another
.eslintrc.js
in the directory containing frontend files (e.g.,public/.eslintrc.js
) with this content:'use strict';
module.exports = require('@esscorp/eslint').configs.frontend;
```
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago