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

Commit 402465d

Browse files
committed
Merge!
2 parents 2b4a36d + 8296fb8 commit 402465d

File tree

25 files changed

+1711
-188
lines changed

25 files changed

+1711
-188
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Linked PRs: (links to corresponding PRs, optional)
2+
3+
## Changes
4+
- (changes here)
5+
6+
## How To Test
7+
- (necessary config changes)
8+
- (necessary corresponding PRs)
9+
- (how to access the new / changed functionality -- fixtures, URLs)
10+
11+
## Applicable Research Resources
12+
- (links, optional)
13+
14+
## TODOs:
15+
- [ ] +1
16+
- [ ] Updated README
17+
- [ ] Updated CHANGELOG
18+
- [ ] (Other applicable TODOs)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
*.sw[a-z]
12
.idea/
23
node_modules

CHANGELOG

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
1-
2.4.4
1+
Pending Release
2+
- Remove `variable-for-property` rule from sass-lint
23
- Adds markdown linting
4+
2.5.3
5+
- Fix #123 by using react/jsx-wrap-multilines rule
6+
- Migrate CSSComb documentation from Confluence to code style repo
7+
2.5.2
8+
- Fix #43 by updating all underlines in Sass code examples
9+
- Fix #114 by removing invalid options from CSSComb config file
10+
- Add a React rule to make sure propTypes are ordered, required ones declared first and callbacks (e.g. onChange) declared last.
11+
- Update ES6 indent rule on switch statements
12+
- Add ignore patterns for unused vars/args to the React configuration
13+
- Ignore non-JS files and node_modules in the ES6 import module
14+
- Add a new ES5 configuration ported to ESLint 2 and up
15+
2.5.1
16+
- Update line length to 200
17+
- Remove rule for no-unresolved import
18+
- Remove 'strict' rule for modules
19+
2.5.0
20+
- Add an ES6 and JSX standard with lint rules.
21+
2.4.4
22+
(??)
323
2.4.3
424
- Add eslint rule + doc entry regarding trailing commas
525
2.4.2

README.md

Lines changed: 66 additions & 6 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
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.
1621

17-
Sample eslint config:
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+
```
27+
28+
29+
Sample eslint Grunt config:
1830
1931
```javascript
2032
eslint:{
@@ -24,11 +36,59 @@ 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
```
44+
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+
61+
## ES6/JSX
62+
63+
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
64+
65+
```yaml
66+
extends:
67+
- './node_modules/mobify-code-style/es6/mobify-es6.yml'
68+
```
69+
70+
and for a React/JSX project:
71+
72+
```yaml
73+
extends:
74+
- './node_modules/mobify-code-style/es6/mobify-es6-react.yml'
75+
```
76+
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+
86+
Make sure to install the following NPM modules:
87+
- `eslint` > 3.0
88+
- `eslint-plugin-import`
89+
- `eslint-import-resolver-webpack`
90+
- `eslint-plugin-react` (for React/JSX linting only)
91+
3292
## CSS
3393
Our Client Services team's [CSS Style Guide](/css/Readme.md). Written with a lot of tender care by @kpeatt and @jeffkamo.
3494

RELEASE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Mobify Code Style
2+
- [ ] Branch off of `develop` and create a `release-vX.Y.Z` branch.
3+
- [ ] Create a new pull request with the following settings:
4+
* Base: `master`
5+
* Compare: `release-vX.Y.Z`
6+
Paste the contents of this checklist into this pull request.
7+
- [ ] Increment the version in `package.json`.
8+
- [ ] In the CHANGELOG.md file of this release branch, change the 'To be released' header to 'vX.Y.Z'.
9+
- [ ] Merge `release-vX.Y.Z` into `master` using the pull request, then delete the release branch.
10+
- [ ] [Publish to npm](https://docs.npmjs.com/cli/publish) from the `master` branch.
11+
- [ ] Draft a new Github release with the following settings:
12+
* Tag version: `X.Y.Z` @ `master`
13+
* Release title: `X.Y.Z`
14+
* Description: Use highlights from the CHANGELOG.md (only pick out the most significant changes)
15+
- [ ] Merge `master` into `develop` (no need for review on PR, just merge).

assets/csscomb.gif

57.8 KB
Loading

css/.csscomb.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
"combinator-space": [" ", " "],
1414
"element-case": "lower",
1515
"eof-newline": true,
16-
"leading-zero": null,
1716
"rule-indent": " ",
1817
"stick-brace": " ",
1918
"unitless-zero": true,
20-
"quotes": false,
2119
"remove-empty-rulesets": true,
2220
"space-before-closing-brace": "\n",
2321
"space-before-colon": "",
@@ -29,7 +27,7 @@
2927
"space-after-selector-delimiter": "\n",
3028
"space-before-selector-delimiter": "",
3129
"strip-spaces": true,
32-
"tab-size": true,
30+
"tab-size": 4,
3331
"unitless-zero": true,
3432
"sort-order": [
3533
[

css/.sass-lint.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,7 @@ rules:
323323
trailing-semicolon: 2
324324
url-quotes: 1 # Only warn here, since sass-lint doesn't understand helpers in urls
325325
variable-for-property:
326-
- 2
327-
- properties:
328-
- font
326+
- 0
329327
variable-name-format:
330328
- 2
331329
- allow-leading-underscore: true

css/Readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@
4545
* [Sass-Lint](sass-lint/readme.md)
4646
* [Using Sass-Lint with Atom](sass-lint/readme.md#using-sass-lint-with-atom)
4747
* [Using Sass-Lint with Sublime Text](sass-lint/readme.md#using-sass-lint-with-sublime-text)
48+
* [CSSComb](csscomb/readme.md)
49+
* [Using CSSComb with Atom](csscomb/readme.md#atom)
50+
* [Using CSSComb with Sublime Text](csscomb/readme.md#sublime-text)
4851

4952
Continue on to [the Introduction →](introduction#introduction)

0 commit comments

Comments
 (0)