2.7.3 • Published 7 years ago

@esscorp/eslint v2.7.3

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

Eslint Configuration

https://www.npmjs.com/package/@esscorp/eslint

Usage

To use this npm module:

  1. Install
  2. Configure Grunt
  3. (Optional) Configure Visual Studio Code
  4. (Optional) Configure Atom
  5. (Optional) Configure Sublime Text

Install

npm install --save @esscorp/eslint;

Configure Grunt

  1. Install grunt-eslint.

    npm install --save-dev grunt-eslint;
  2. 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');
};
```
  1. Fill out <file-patterns-here> in the backend.src and frontend.src arrays. (additional info here)

  2. 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'
	]);
};
```
  1. Test with grunt and grunt lint.

Configure Visual Studio Code

NOTE: This is optional.

  1. Open Settings.

    • OS X: ,
    • Linux: CTRL,
  2. Add to USER SETTINGS:

    "eslint.autoFixOnSave": true,
    "eslint.options": {
        "rulePaths": [
            "node_modules/@esscorp/eslint/rules"
        ]
    },
  3. Create .eslintrc.js in the top-level directory of the repo (next to package.json) with this content:

    	'use strict';
	module.exports = require('@esscorp/eslint').configs.backend;
```
  1. 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.

  1. Open Settings.

    • OS X: ,
    • Linux: CTRL,
  2. Go to Install.

  3. Search for and install linter.

  4. Search for and install linter-eslint.

  5. Configure linter-eslint.

    1. Click Settings button under linter-eslint.
    2. Set ESLint Rules Dir to
      node_modules/@esscorp/eslint/rules
    3. Set .eslintrc Path to
      node_modules/@esscorp/eslint/configs/backend.js
  6. Create .eslintrc.js in the top-level directory of the repo (next to package.json) with this content:

    	'use strict';
	module.exports = require('@esscorp/eslint').configs.backend;
```
  1. 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.

  1. Install Package Control if it is not installed already.

  2. Install ESLint.

    1. Open Package Control.
      • OS X: P
      • Linux: CTRLSHIFTP
    2. Search for and select Package Control: Install Package.
    3. Search for and select ESLint.
  3. Install SublimeLinter-contrib-eslint.

    1. Open Package Control.
      • OS X: P
      • Linux: CTRLSHIFTP
    2. Search for and select Package Control: Install Package.
    3. Search for and select SublimeLinter-contrib-eslint.
  4. Configure SublimeLinter-contrib-eslint.

    1. In the menu, navigate to Preferences > Package Settings > SublimeLinter > Settings - User
    2. Add or insert this content:
      {
          "user": {
              "linters": {
                  "eslint": {
                      "@disable": false,
                      "args": ["--rulesdir", "node_modules/@esscorp/eslint/rules"],
                      "excludes": [
                          "**/node_modules/**"
                      ]
                  }
              }
          }
      }
  5. Create .eslintrc.js in the top-level directory of the repo (next to package.json) with this content:

    	'use strict';
	module.exports = require('@esscorp/eslint').configs.backend;
```
  1. 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;
```
2.7.3

7 years ago

2.7.2

7 years ago

2.7.1

7 years ago

2.7.0

7 years ago

2.6.3

7 years ago

2.6.2

7 years ago

2.6.1

7 years ago

2.6.0

7 years ago

2.5.1

7 years ago

2.4.1

7 years ago

2.4.0

7 years ago

2.3.0

7 years ago

2.2.4

7 years ago

2.2.3

8 years ago

2.2.2

8 years ago

2.2.1

8 years ago

2.2.0

8 years ago

2.1.0

9 years ago

2.0.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.8

9 years ago