Skip to content

Commit dbc954e

Browse files
authored
Add prettier and run prettier command via lint-staged (digitalocean#448)
1 parent c908a32 commit dbc954e

File tree

186 files changed

+4286
-1432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+4286
-1432
lines changed

.eslintrc.cjs

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,44 @@
11
module.exports = {
2-
env: {
3-
'browser': true,
4-
'node': true,
5-
},
6-
extends: [
7-
'eslint:recommended',
8-
'plugin:vue/recommended',
9-
],
10-
parserOptions: {
11-
parser: '@babel/eslint-parser',
12-
ecmaVersion: 2018,
13-
sourceType: 'module',
14-
requireConfigFile: false,
15-
},
16-
rules: {
17-
'linebreak-style': ['error', 'unix'],
18-
semi: ['error', 'always'],
19-
quotes: ['error', 'single'],
20-
'comma-dangle': ['error', 'always-multiline'],
21-
'vue/require-v-for-key': 0,
22-
'vue/require-default-prop': 0,
23-
'vue/no-v-html': 0,
24-
'vue/max-attributes-per-line': 0,
25-
'vue/html-indent': ['error', 4],
26-
'vue/script-indent': ['error', 4, {
27-
baseIndent: 1,
28-
}],
29-
'vue/no-unused-vars': 0,
30-
'vue/html-self-closing': 0,
31-
'vue/multi-word-component-names': 0,
32-
'vue/no-reserved-component-names': 0,
33-
'eol-last': ['error', 'always'],
34-
},
35-
globals: {
36-
'describe': true,
37-
'expect': true,
38-
'it': true,
39-
'test': true,
40-
},
2+
env: {
3+
browser: true,
4+
node: true,
5+
},
6+
extends: ['eslint:recommended', 'plugin:vue/recommended', 'prettier'],
7+
parserOptions: {
8+
parser: '@babel/eslint-parser',
9+
ecmaVersion: 2018,
10+
sourceType: 'module',
11+
requireConfigFile: false,
12+
},
13+
rules: {
14+
'linebreak-style': ['error', 'unix'],
15+
semi: ['error', 'always'],
16+
'comma-dangle': ['error', 'always-multiline'],
17+
'vue/require-v-for-key': 0,
18+
'vue/require-default-prop': 0,
19+
'vue/no-v-html': 0,
20+
'vue/max-attributes-per-line': 0,
21+
'vue/html-indent': ['error', 4],
22+
'vue/script-indent': [
23+
'error',
24+
4,
25+
{
26+
baseIndent: 1,
27+
switchCase: 1,
28+
},
29+
],
30+
'vue/no-unused-vars': 'warn',
31+
'vue/html-self-closing': 0,
32+
'vue/multi-word-component-names': 0,
33+
'vue/no-reserved-component-names': 0,
34+
'eol-last': ['error', 'always'],
35+
'prettier/prettier': 'error',
36+
},
37+
globals: {
38+
describe: true,
39+
expect: true,
40+
it: true,
41+
test: true,
42+
},
43+
plugins: ['prettier'],
4144
};

.github/workflows/test-workflow.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,22 @@ jobs:
5959

6060
- name: Test i18n packs integrity
6161
run: npm run test:i18n-packs
62+
63+
prettier:
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v3
69+
70+
- name: Use Node.js
71+
uses: actions/setup-node@v3
72+
with:
73+
node-version-file: .nvmrc
74+
cache: npm
75+
76+
- name: Install dependencies
77+
run: npm ci
78+
79+
- name: Test with prettier
80+
run: npm run test:prettier

.lintstagedrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"*.{js,vue}": [
3+
"prettier --write",
4+
"eslint --quiet --cache --fix"
5+
],
6+
"*.scss": [
7+
"stylelint --config node_modules/do-bulma/.stylelintrc.json --fix"
8+
]
9+
}

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package.json
2+
package-lock.json

.prettierrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"vueIndentScriptAndStyle": true,
5+
"htmlWhitespaceSensitivity": "ignore",
6+
"printWidth": 100,
7+
"tabWidth": 4,
8+
"singleAttributePerLine": true
9+
}

0 commit comments

Comments
 (0)