Skip to content

Commit 71d76e1

Browse files
authored
feat(prettier): prettify on commit (#51)
1 parent eba815d commit 71d76e1

15 files changed

+4182
-667
lines changed

Diff for: .editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
root = true
33

44
[*]
5-
indent_style = tab
5+
indent_style = space
66
indent_size = 4
77
end_of_line = lf
88
charset = utf-8

Diff for: .eslintrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
'use strict';
1+
'use strict'
22

3-
module.exports = require('./index');
3+
module.exports = require('./index')

Diff for: .github/CONTRIBUTING.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
Thank you for your interest. `eslint-config-fullstack` generally conforms to the following principles:
44

5-
* Configuring rules
6-
* Maintain a list of every base ESLint rule & every `eslint-plugin-react` rule. This means tracking changes to those packages, which [Greenkeeper](https://greenkeeper.io/) helps with.
7-
* When a new version of those deps is published, read the changelog and add / modify the relevant rules in the corresponding Greenkeeper branch. **Do not** simply merge the GK branch as-is.
8-
* When simply turning rules off, set them to `0`, do not delete them
9-
* Delete deprecated rules only
10-
* Keep the rule summary, verbatim from the corresponding API reference, as a comment following the rule
11-
* Activate rules whose pedagogical and/or stylistic value outweighs their annoyance
12-
* If a rule *almost definitely* indicates broken code, set it to `2` (error)
13-
* If a rule *quite possibly* flags code that could still work, set it to `1` (warning)
14-
* Code style
15-
* This repo uses [Prettier](https://prettier.io/) and [lint-staged](https://github.com/okonet/lint-staged) to automatically maintain formatting.
16-
* If you prefer, you can run Prettier yourself on the code to preview how it will be auto-formatted, using `npm run prettify` or activating an [editor plugin](https://prettier.io/docs/en/editors.html)
17-
* Respect [SEMVER](https://semver.org/) when publishing to npm
18-
* Turning rules off will count as a minor change as nobody's code should break (in theory)
19-
* Turning rules on or changing their options should count as a major change as linting may now result in nonzero exit codes where none existed before
5+
* Configuring rules
6+
* Maintain a list of every base ESLint rule & every `eslint-plugin-react` rule. This means tracking changes to those packages, which [Greenkeeper](https://greenkeeper.io/) helps with.
7+
* When a new version of those deps is published, read the changelog and add / modify the relevant rules in the corresponding Greenkeeper branch. **Do not** simply merge the GK branch as-is.
8+
_ When simply turning rules off, set them to `0`, do not delete them
9+
_ Delete deprecated rules only
10+
* Keep the rule summary, verbatim from the corresponding API reference, as a comment following the rule
11+
* Activate rules whose pedagogical and/or stylistic value outweighs their annoyance
12+
* If a rule _almost definitely_ indicates broken code, set it to `2` (error)
13+
* If a rule _quite possibly_ flags code that could still work, set it to `1` (warning)
14+
* Code style
15+
* This repo uses [Prettier](https://prettier.io/) and [lint-staged](https://github.com/okonet/lint-staged) to automatically maintain formatting.
16+
* If you prefer, you can run Prettier yourself on the code to preview how it will be auto-formatted, using `npm run prettify` or activating an [editor plugin](https://prettier.io/docs/en/editors.html)
17+
* Respect [SEMVER](https://semver.org/) when publishing to npm
18+
* Turning rules off will count as a minor change as nobody's code should break (in theory)
19+
* Turning rules on or changing their options should count as a major change as linting may now result in nonzero exit codes where none existed before

Diff for: .github/ISSUE_TEMPLATE.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
For bugs, please include the following:
22

3-
* What is the expected behavior?
4-
* What is the actual behavior?
5-
* What steps reproduce the behavior?
3+
* What is the expected behavior?
4+
* What is the actual behavior?
5+
* What steps reproduce the behavior?
66

77
---
88

9-
*Issue description here…*
9+
_Issue description here…_

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
Please check all that apply.
44

5-
- [ ] referenced any relevant issue(s)
6-
- [ ] Adding new rule(s)?
7-
- [ ] Included rule summary verbatim from docs as a comment
8-
- [ ] Placed in the right section (stylistic / node / etc.), in alphabetical order
9-
- [ ] Set to `0` (off), `1` (warn), or `2` (error) as spec'd in contributing guidelines
10-
- [ ] Changing active rule(s) severity?
11-
- [ ] Set to `1` (warn), or `2` (error) as spec'd in contributing guidelines
12-
- [ ] Removing rule(s)?
13-
- [ ] Set to `0` if disabling, or delete _only if deprecated_
5+
* [ ] referenced any relevant issue(s)
6+
* [ ] Adding new rule(s)?
7+
* [ ] Included rule summary verbatim from docs as a comment
8+
* [ ] Placed in the right section (stylistic / node / etc.), in alphabetical order
9+
* [ ] Set to `0` (off), `1` (warn), or `2` (error) as spec'd in contributing guidelines
10+
* [ ] Changing active rule(s) severity?
11+
* [ ] Set to `1` (warn), or `2` (error) as spec'd in contributing guidelines
12+
* [ ] Removing rule(s)?
13+
* [ ] Set to `0` if disabling, or delete _only if deprecated_
1414

1515
---
1616

17-
*Your PR Notes Here*
17+
_Your PR Notes Here_

Diff for: .prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock.json

Diff for: .prettierrc.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# printWidth: 80 # 80
2+
# tabWidth: 4 # 2 -- redundant with .editorconfig
3+
# useTabs: false # false -- redundant with .editorconfig
4+
semi: false # true
5+
singleQuote: true # false
6+
trailingComma: all # none | es5 | all
7+
# bracketSpacing: true # true
8+
# jsxBracketSameLine: false # false
9+
# arrowParens: avoid # avoid | always

Diff for: README.md

+9-21
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ In your global `~/.eslintrc.json` file:
2323

2424
```json
2525
{
26-
"extends": "fullstack"
26+
"extends": "fullstack"
2727
}
2828
```
2929

@@ -35,37 +35,25 @@ A specific project can extend this definition by including `eslint eslint-config
3535

3636
```json
3737
{
38-
"extends": "fullstack",
39-
"root": true
38+
"extends": "fullstack",
39+
"root": true
4040
}
4141
```
4242

43-
### For Babel-Transpiled Projects
43+
### Note on Parsing
4444

45-
This config's peer dependencies (eslint, eslint-plugin-react) enable linting relatively modern files including JSX components. If you find that the linter fails to understand some early-stage ES features, you can enable parsing using Babel instead of ESLint's default parser. Install `babel-eslint` and set the `parser` option of your config:
46-
47-
```sh
48-
npm install babel-eslint --save-dev
49-
```
50-
51-
```json
52-
{
53-
"parser": "babel-eslint",
54-
"extends": "fullstack",
55-
"root": true
56-
}
57-
```
45+
This config now uses `babel-eslint` as the parser by default. This enables linting some relatively modern code which ESLint's default parser does not handle, and was necessary for this project to lint itself. You do not need to install `babel-eslint` manually as it is a dependency of this config.
5846

5947
## Extending
6048

6149
Any [rules](http://eslint.org/docs/rules/) added to your global or local `.eslintrc.json` files will override the rules defined by this package. For example:
6250

6351
```json
6452
{
65-
"extends": "fullstack",
66-
"rules": {
67-
"semi": [1, "always"]
68-
}
53+
"extends": "fullstack",
54+
"rules": {
55+
"semi": [1, "always"]
56+
}
6957
}
7058
```
7159

Diff for: index.js

+15-22
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict';
1+
'use strict'
22

33
/**
44
* Fullstack Education Group
@@ -8,27 +8,20 @@
88
*/
99

1010
module.exports = {
11+
extends: ['./rules/base', './rules/react'].map(require.resolve),
1112

12-
extends: [
13-
'./rules/base',
14-
'./rules/react'
15-
].map(require.resolve),
13+
env: {
14+
es6: true,
15+
browser: true,
16+
node: true,
17+
mocha: true,
18+
jasmine: true,
19+
jquery: true,
20+
},
1621

17-
env: {
18-
es6: true,
19-
browser: true,
20-
node: true,
21-
mocha: true,
22-
jasmine: true,
23-
jquery: true,
24-
},
22+
parser: 'babel-eslint',
2523

26-
parserOptions: {
27-
ecmaVersion: 6
28-
},
29-
30-
globals: {
31-
angular: true
32-
}
33-
34-
};
24+
globals: {
25+
angular: true,
26+
},
27+
}

0 commit comments

Comments
 (0)