Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 0d5a5de

Browse files
author
Marlow Payne
committed
Merge branch 'develop' into fix-114
2 parents 5e51778 + 094635d commit 0d5a5de

File tree

7 files changed

+705
-9
lines changed

7 files changed

+705
-9
lines changed

CHANGELOG

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
Pending Release:
1+
2.5.2
22
- Fix #114 by removing invalid options from CSSComb config file
3+
- Update ES6 indent rule on switch statements
4+
- Add ignore patterns for unused vars/args to the React configuration
5+
- Ignore non-JS files and node_modules in the ES6 import module
6+
- Add a new ES5 configuration ported to ESLint 2 and up
37
2.5.1
48
- Update line length to 200
59
- Remove 'strict' rule for modules

README.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,29 @@ A repo to document code standards for different languages and provide tools for
44

55
[![NPM version](https://badge.fury.io/js/mobify-code-style.svg)](http://badge.fury.io/js/mobify-code-style)
66

7-
## JavaScript (ES5)
7+
## JavaScript (ES5) with Grunt
88

9-
Typically, we lint our javascript files using [Grunt](http://gruntjs.com/) and [grunt-eslint](https://github.com/sindresorhus/grunt-eslint). grunt-eslint is a Grunt helper for the [ESLint](http://eslint.org/) linter.
9+
Typically, we lint our javascript files using
10+
[Grunt](http://gruntjs.com/) and
11+
[grunt-eslint](https://github.com/sindresorhus/grunt-eslint). grunt-eslint
12+
is a Grunt helper for the [ESLint](http://eslint.org/) linter.
1013

1114
To add javascript linting to your project:
1215

1316
1. Install the NPM `mobify-code-style` and `grunt-eslint` modules.
14-
2. Create a [Gruntfile](http://gruntjs.com/sample-gruntfile) if you don't have one already.
15-
3. In the initConfig of your gruntfile, add a section for eslint pointing to the correct linting file.
17+
2. Create a [Gruntfile](http://gruntjs.com/sample-gruntfile) if you
18+
don't have one already.
19+
3. Create an `.eslintrc.yml` file in the root of your project directory
20+
4. In the initConfig of your gruntfile, add a section for eslint pointing to the correct linting file.
21+
22+
The `.eslintrc.yml` file should contain, to begin with:
23+
```yaml
24+
extends:
25+
- './node_modules/mobify-code-style/es5/mobify-es5.yml'
26+
```
1627
17-
Sample eslint config:
28+
29+
Sample eslint Grunt config:
1830
1931
```javascript
2032
eslint:{
@@ -24,20 +36,36 @@ eslint:{
2436
// When true, eslint will test _only_ the rules set in the provided
2537
// configuration file
2638
reset: false,
27-
config: 'node_modules/mobify-code-style/javascript/.eslintrc'
39+
configFile: './.eslintrc.yml'
2840
}
2941
}
3042
}
3143
```
3244

45+
### Migrating from ESLint 0.x or 1.x to ESlint 2.x or 3.x
46+
47+
If you upgrade the version of `grunt-eslint` you use from one that
48+
pulls in ESLint 1.x or lower to one that pulls
49+
in ESLint 2.x or greater, you must modify the configuration files to
50+
include the new style of configuration.
51+
52+
If the Grunt config includes the default config
53+
`./node_modules/mobify-code-style/javascript/.eslintrc`, replace that
54+
with `./.eslintrc.yml`, and add an `.eslintrc.yml` to the project root
55+
as described above.
56+
57+
If there are modifications to the lint configuration in the project,
58+
please check the migration guides at [http://eslint.org/] to port the
59+
modified lint config to ESLint 3.x.
60+
3361
## ES6/JSX
3462

3563
We use [ESLint](http://eslint.org/) to lint ES6 and React/JSX code. If ESLint is installed in a project, we can use the configuration from this module by creating a file in the project root named `.eslintrc.yml`. If the project does not use JSX, the file contents should be
3664

3765
```yaml
3866
extends:
3967
- './node_modules/mobify-code-style/es6/mobify-es6.yml'
40-
```
68+
```
4169
4270
and for a React/JSX project:
4371
@@ -46,6 +74,15 @@ extends:
4674
- './node_modules/mobify-code-style/es6/mobify-es6-react.yml'
4775
```
4876
77+
If using a custom Webpack configuration, add the lines:
78+
```yaml
79+
settings:
80+
import/resolver:
81+
webpack:
82+
config: '<path-to-webpack-config>'
83+
```
84+
to the `.eslintrc.yml`
85+
4986
Make sure to install the following NPM modules:
5087
- `eslint` > 3.0
5188
- `eslint-plugin-import`

0 commit comments

Comments
 (0)