Skip to content

Commit d419f9c

Browse files
committed
style: update prettier
1 parent de01b41 commit d419f9c

File tree

6 files changed

+97
-73
lines changed

6 files changed

+97
-73
lines changed

.babelrc

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
{
2-
"env": {
3-
"test": {
4-
"presets": [
5-
["env", { "targets": { "node": "current" } }]
6-
],
7-
"plugins": [
8-
"transform-vue-jsx",
9-
"transform-object-assign",
10-
"transform-object-rest-spread",
11-
"transform-class-properties",
12-
"transform-runtime"
13-
]
14-
}
2+
"env": {
3+
"test": {
4+
"presets": [["env", { "targets": { "node": "current" } }]],
5+
"plugins": [
6+
"transform-vue-jsx",
7+
"transform-object-assign",
8+
"transform-object-rest-spread",
9+
"transform-class-properties",
10+
"transform-runtime"
11+
]
1512
}
13+
}
1614
}

.eslintrc

+35-24
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
{
2-
"root": true,
3-
"env": {
4-
"browser": true,
5-
"node": true,
6-
"jasmine": true,
7-
"jest": true,
8-
"es6": true
9-
},
10-
"parserOptions": {
11-
"parser": "babel-eslint"
12-
},
13-
"extends": ["plugin:vue/recommended", "prettier"],
14-
"rules": {
15-
"comma-dangle": [2, "always-multiline"],
16-
"no-var": "error",
17-
"camelcase": "off",
18-
"no-extra-boolean-cast": "off",
19-
"semi": ["error", "always"],
20-
"vue/require-prop-types": "off",
21-
"vue/require-default-prop": "off",
22-
"vue/no-reserved-keys": "off",
23-
"vue/prop-name-casing": "off"
24-
}
25-
}
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"node": true,
6+
"jasmine": true,
7+
"jest": true,
8+
"es6": true
9+
},
10+
"parserOptions": {
11+
"parser": "babel-eslint"
12+
},
13+
"extends": ["plugin:vue/recommended", "prettier"],
14+
"plugins": ["markdown"],
15+
"rules": {
16+
"comma-dangle": [2, "always-multiline"],
17+
"no-var": "error",
18+
"camelcase": "off",
19+
"no-extra-boolean-cast": "off",
20+
"semi": ["error", "always"],
21+
"vue/require-prop-types": "off",
22+
"vue/require-default-prop": "off",
23+
"vue/no-reserved-keys": "off",
24+
"vue/prop-name-casing": "off",
25+
"vue/max-attributes-per-line": [
26+
2,
27+
{
28+
"singleline": 20,
29+
"multiline": {
30+
"max": 1,
31+
"allowFirstLine": false
32+
}
33+
}
34+
]
35+
}
36+
}

.jest.js

+15-25
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,31 @@
11
const libDir = process.env.LIB_DIR;
22

33
const transformIgnorePatterns = [
4-
'/dist/', 'node_modules\/[^/]+?\/(?!(es|node_modules)\/)', // Ignore modules without es dir
4+
'/dist/',
5+
'node_modules/[^/]+?/(?!(es|node_modules)/)', // Ignore modules without es dir
56
];
67

78
module.exports = {
89
testURL: 'http://localhost/',
910
setupFiles: ['./tests/setup.js'],
10-
moduleFileExtensions: [
11-
"js",
12-
"jsx",
13-
"json",
14-
"vue",
15-
"md",
16-
"jpg"
17-
],
11+
moduleFileExtensions: ['js', 'jsx', 'json', 'vue', 'md', 'jpg'],
1812
modulePathIgnorePatterns: ['/_site/'],
19-
testPathIgnorePatterns: [
20-
'/node_modules/', 'node'
21-
],
13+
testPathIgnorePatterns: ['/node_modules/', 'node'],
2214
transform: {
23-
".*\\.(vue|md)$": "<rootDir>/node_modules/vue-jest",
24-
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
25-
"^.+\\.svg$": "<rootDir>/node_modules/jest-transform-stub"
15+
'.*\\.(vue|md)$': '<rootDir>/node_modules/vue-jest',
16+
'^.+\\.(js|jsx)$': '<rootDir>/node_modules/babel-jest',
17+
'^.+\\.svg$': '<rootDir>/node_modules/jest-transform-stub',
2618
},
27-
testRegex: libDir === 'dist'
28-
? 'demo\\.test\\.js$'
29-
: '.*\\.test\\.js$',
19+
testRegex: libDir === 'dist' ? 'demo\\.test\\.js$' : '.*\\.test\\.js$',
3020
moduleNameMapper: {
31-
"^@/(.*)$": "<rootDir>/$1",
32-
"ant-design-vue": "<rootDir>/components/index.js",
33-
"^vue$": "vue/dist/vue.common.js"
21+
'^@/(.*)$': '<rootDir>/$1',
22+
'ant-design-vue': '<rootDir>/components/index.js',
23+
'^vue$': 'vue/dist/vue.common.js',
3424
},
35-
snapshotSerializers: ["<rootDir>/node_modules/jest-serializer-vue"],
25+
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
3626
collectCoverage: process.env.COVERAGE === 'true',
3727
collectCoverageFrom: [
38-
"components/**/*.{js,jsx,vue}",
28+
'components/**/*.{js,jsx,vue}',
3929
'!components/*/style/index.{js,jsx}',
4030
'!components/style/*.{js,jsx}',
4131
'!components/*/locale/*.{js,jsx}',
@@ -46,7 +36,7 @@ module.exports = {
4636
'!components/align/**/*',
4737
'!components/trigger/**/*',
4838
'!components/style.js',
49-
"!**/node_modules/**"
39+
'!**/node_modules/**',
5040
],
51-
transformIgnorePatterns
41+
transformIgnorePatterns,
5242
};

.prettierignore

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1-
**/*.md
21
**/*.svg
3-
**/*.ejs
4-
**/*.html
52
package.json
6-
es/**
7-
lib/**
8-
_site/**
9-
dist/**
3+
lib/
4+
es/
5+
dist/
6+
_site/
7+
coverage/
8+
CNAME
9+
LICENSE
10+
yarn.lock
11+
netlify.toml
12+
yarn-error.log
13+
*.sh
14+
*.snap
15+
.gitignore
16+
.npmignore
17+
.prettierignore
18+
.DS_Store
19+
.editorconfig
20+
.eslintignore
21+
**/*.yml
22+
components/style/color/*.less
23+
**/assets
24+
.gitattributes
25+
.stylelintrc
26+
.vcmrc

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
}
1212
}
1313
]
14-
}
14+
}

package.json

+11-3
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@
3636
"pub-with-ci": "node antd-tools/cli/run.js pub-with-ci",
3737
"prepublish": "node antd-tools/cli/run.js guard",
3838
"pre-publish": "node ./scripts/prepub",
39+
"prettier": "prettier -c --write '**/*'",
40+
"pretty-quick": "pretty-quick",
3941
"dist": "node antd-tools/cli/run.js dist",
4042
"lint": "eslint -c ./.eslintrc --fix --ext .jsx,.js,.vue ./components",
4143
"lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
4244
"commitmsg": "commitlint -x @commitlint/config-conventional -e $GIT_PARAMS",
4345
"codecov": "codecov",
44-
"prettier": "node ./scripts/prettier.js",
4546
"postinstall": "node scripts/postinstall || echo \"ignore\""
4647
},
4748
"repository": {
@@ -57,6 +58,11 @@
5758
"lint",
5859
"prettier"
5960
],
61+
"husky": {
62+
"hooks": {
63+
"pre-commit": "pretty-quick --staged"
64+
}
65+
},
6066
"peerDependencies": {
6167
"vue": ">=2.6.6",
6268
"vue-template-compiler": ">=2.6.6"
@@ -107,6 +113,7 @@
107113
"eslint": "^5.8.0",
108114
"eslint-config-prettier": "^3.0.1",
109115
"eslint-plugin-html": "^3.2.2",
116+
"eslint-plugin-markdown": "^1.0.0",
110117
"eslint-plugin-vue": "^5.1.0",
111118
"fetch-jsonp": "^1.1.3",
112119
"fs-extra": "^7.0.0",
@@ -140,7 +147,8 @@
140147
"postcss": "^7.0.6",
141148
"postcss-loader": "^3.0.0",
142149
"pre-commit": "^1.2.2",
143-
"prettier": "^1.15.3",
150+
"prettier": "^1.18.2",
151+
"pretty-quick": "^1.11.1",
144152
"querystring": "^0.2.0",
145153
"raw-loader": "^1.0.0-beta.0",
146154
"reqwest": "^2.0.5",
@@ -215,4 +223,4 @@
215223
"lib/**/style/*",
216224
"*.less"
217225
]
218-
}
226+
}

0 commit comments

Comments
 (0)