Skip to content

Commit

Permalink
🎁 Add Prettier configs for Standard & Vue (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
stormwarning authored Jan 21, 2019
1 parent 4a18a78 commit a31adb8
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 20 deletions.
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,44 @@

Install the conventions by running:

```sh
```shell
npm install --save-dev eslint @zazen/eslint-config
```

Then add the extends to your `.eslintrc.js`:
Add the extends to your `.eslintrc.js`:

```js
{
extends: '@zazen/eslint-config',
rules: { /**/ }
extends: ['@zazen/eslint-config'],
rules: { /**/ }
}
```

Add the Prettier settings to your `package.json`:

```json
"prettier": {
"arrowParens": "always",
"semi": false,
"singleQuote": true,
"tabWidth": 4
},
```

### Vue.js projects

Install the optionalDependency `eslint-plugin-vue`:

```shell
npm install --save-dev eslint-plugin-vue
```

Extend the Vue-specific settings in `.eslintrc.js`:

```js
{
extends: ['@zazen/eslint-config', '@zazen/eslint-config/vue'],
rules: { /**/ }
}
```

Expand Down
16 changes: 2 additions & 14 deletions code-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,8 @@
* Enforce a consistent code style.
*/
module.exports = {
extends: ['prettier', 'prettier/standard'],
rules: {
'array-bracket-spacing': ['error', 'never'],
'arrow-parens': ['error', 'always'],
'comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
},
],
indent: ['error', 4],
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
// 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
},
}
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "@zazen/eslint-config",
"description": "Lint JavaScript, free of weariness and confusion",
"license": "MIT",
"license": "ISC",
"author": "Jeff <rustyangel@gmail.com> (https://tidaltheory.co)",
"homepage": "https://github.com/stormwarning/zazen-eslint-config",
"repository": "stormwarning/zazen-eslint-config",
"version": "0.3.0",
"scripts": {
"eslint-check": "eslint --print-config . | eslint-config-prettier-check",
"lint": "npm-run-all lint:*",
"lint:markdown": "remark . -qo",
"lint:scripts": "prettier-eslint '**/*.js' --write --list-different",
Expand All @@ -17,6 +18,7 @@
},
"dependencies": {
"babel-eslint": "^10.0.1",
"eslint-config-prettier": "^3.6.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
Expand Down Expand Up @@ -52,6 +54,12 @@
"git add"
]
},
"prettier": {
"arrowParens": "always",
"semi": false,
"singleQuote": true,
"tabWidth": 4
},
"remarkConfig": {
"plugins": [
"preset-lint-markdown-style-guide",
Expand Down
2 changes: 1 addition & 1 deletion vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
* Vuejs project rules.
*/
module.exports = {
extends: ['plugin:vue/recommended'],
extends: ['plugin:vue/recommended', 'prettier/vue'],
}

0 comments on commit a31adb8

Please sign in to comment.