Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
Changed: base theme now provides a less strict eslint config (only es…
Browse files Browse the repository at this point in the history
…lint + eslint-plugin-react recommended rules)

Closes #631
  • Loading branch information
MoOx committed Oct 10, 2016
1 parent 0fbd6c9 commit 038f0cc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 53 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- Changed: base theme now provides a less strict eslint config
(only eslint + eslint-plugin-react recommended rules)

# 0.17.8 - 2016-10-08

- Fixed: Service worker file was imported relatively, which only works at the
Expand Down
45 changes: 11 additions & 34 deletions docs/content/docs/advanced/good-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,32 @@ title: Good practices

## Linting

Our phenomic-theme-base comes with best-in-class tools for linting both JavaScript
and CSS. Linting your code is a good practice because it reduces the probability
Our base theme comes with best-in-class tools for linting both JavaScript
and CSS.
Linting your code is a good practice because it reduces the probability
of errors and helps to enforce code consistency.

## JavaScript Linting

[ESLint](http://eslint.org/) is a must have JavaScript linter; the default
phenomic-theme-base provides you with a nice [standard set of rules](https://github.com/MoOx/eslint-config-i-am-meticulous)
for ES2015+ & React.
[ESLint](http://eslint.org/) is a must have JavaScript linter.
The base theme provides you with a standard set of rules for ES2015+ & React
(via eslint and eslint-plugin-react recommended config).

That being said, you might want less rules (or semicolons).
### Alternative config

### Less strict JavaScript linting

To remove the default config, you can replace the ``eslintConfig`` in your
``package.json`` with the following config:

```json
{
"eslintConfig": {
"parser": "babel-eslint",
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true
},
},
"env": {
"node": true,
"browser": true,
"es6": true
}
}
}
```

In this example, we used ``eslint:recommended``, but feel free to use one of the
Feel free to use one of the
[many existing configs](https://www.npmjs.com/search?q=eslint-config).

Here are some "popular" configs:

- https://github.com/feross/eslint-config-standard
- https://github.com/feross/eslint-config-standard-react
- https://github.com/sindresorhus/eslint-config-xo
- https://github.com/sindresorhus/eslint-config-xo-react
- https://github.com/MoOx/eslint-config-i-am-meticulous

If you switch to one of these configurations, you might get some linting errors.
To fix this, simply use the following command:
To fix most of this errors, use the following command:

```sh
./node_modules/.bin/eslint --fix .
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@
"babel-preset-stage-1": "^6.13.0",
"css-loader": "^0.25.0",
"eslint": "^3.7.1",
"eslint-config-i-am-meticulous": "^5.0.2",
"eslint-loader": "^1.5.0",
"eslint-plugin-import": "^2.0.0",
"eslint-plugin-react": "^6.3.0",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
Expand Down
31 changes: 14 additions & 17 deletions src/bin/commands/setup/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,21 @@ const template = {
"eslintConfig": {
"parser": "babel-eslint",
"extends": [
"eslint-config-i-am-meticulous/react",
"eslint:recommended",
"plugin:react/recommended",
],
"rules": {
"import/order": "off",
"import/newline-after-import": "off",
"import/imports-first": "off",
"import/no-mutable-exports": "off",
"import/max-dependencies": "off",
"import/default": "off",
"import/no-namespace": "off",
"import/namespace": "off",
"react/jsx-indent": "off",
"import/no-named-as-default": "off",
"import/no-extraneous-dependencies": "off",
"import/no-duplicates": "off",
"react/no-children-prop": "off",
"react/jsx-no-target-blank": "off",
"import/no-unresolved": "off",
"env": {
"browser": true,
"node": true,
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"generators": true,
"experimentalObjectRestSpread": true,
},
},
},
"stylelint": {
Expand Down

0 comments on commit 038f0cc

Please sign in to comment.