未验证 提交 cc970b00 编写于 作者: 陈帅 提交者: GitHub

add lint prettier in Ci (#3262)

* add lint prettier in Ci

* .circleci use version =2

* remove jest in package

* update package.json

* add enzyme

* fix appveyor error

* use check-prettier script
上级 2441f753
......@@ -6,6 +6,7 @@ jobs:
steps:
- checkout
- run: npm install
- run: npm run lint
- run: npm run build
test:
docker:
......@@ -13,12 +14,12 @@ jobs:
steps:
- checkout
- run: npm install
- run:
command : npm run test:all
no_output_timeout : 30m
- run:
command: npm run test:all
no_output_timeout: 30m
workflows:
version: 2
build_and_test:
jobs:
- build
- test
\ No newline at end of file
- test
# Test against the latest version of this Node.js version
environment:
nodejs_version: "8"
nodejs_version: '10'
# this is how to allow failing jobs in the matrix
matrix:
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.
# Install scripts. (runs after repo cloning)
install:
......
// ps https://github.com/GoogleChrome/puppeteer/issues/3120
module.exports = {
launch: {
headless: false,
headless: true,
args: [
'--disable-gpu',
'--disable-dev-shm-usage',
......
......@@ -11,7 +11,8 @@
"site": "npm run presite && cross-env APP_TYPE=site npm run build && firebase deploy && npm run docker:push",
"analyze": "cross-env ANALYZE=1 umi build",
"lint:style": "stylelint \"src/**/*.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style",
"lint:prettier": "check-prettier lint",
"lint": "eslint --ext .js src mock tests && npm run lint:style && npm run lint:prettier",
"lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js",
......@@ -30,11 +31,12 @@
"docker:push": "npm run docker-hub:build && npm run docker:tag && docker push chenshuai2144/ant-design-pro"
},
"dependencies": {
"@babel/runtime": "^7.1.5",
"antd": "^3.10.9",
"bizcharts": "^3.4.0",
"bizcharts-plugin-slider": "^2.1.1-beta.1",
"@antv/data-set": "^0.10.0",
"@babel/runtime": "^7.2.0",
"antd": "^3.11.6",
"bizcharts": "^3.4.2",
"bizcharts-plugin-slider": "^2.1.1-beta.1",
"check-prettier": "^1.0.1",
"classnames": "^2.2.6",
"dva": "^2.4.0",
"enquire-js": "^0.2.1",
......@@ -67,7 +69,7 @@
"babel-eslint": "^10.0.1",
"cross-env": "^5.1.1",
"cross-port-killer": "^1.0.1",
"enzyme": "^3.7.0",
"enzyme": "3.7.0",
"eslint": "^5.4.0",
"eslint-config-airbnb": "^17.0.0",
"eslint-config-prettier": "^3.0.1",
......@@ -85,16 +87,16 @@
"mockjs": "^1.0.1-beta3",
"prettier": "1.15.2",
"pro-download": "^1.0.1",
"slash2": "^2.0.0",
"stylelint": "^9.8.0",
"stylelint-config-prettier": "^4.0.0",
"stylelint-config-standard": "^18.0.0",
"tslint": "^5.10.0",
"tslint-config-prettier": "^1.10.0",
"tslint-react": "^3.6.0",
"umi": "^2.2.7",
"umi": "^2.3.1",
"umi-plugin-ga": "^1.1.3",
"umi-plugin-react": "^1.2.0",
"slash2": "^2.0.0"
"umi-plugin-react": "^1.2.0"
},
"optionalDependencies": {
"puppeteer": "^1.10.0"
......@@ -115,6 +117,13 @@
"last 2 versions",
"not ie <= 10"
],
"checkFiles": [
"src/**/*.js*",
"src/**/*.ts*",
"src/**/*.less",
"config/**/*.js*",
"scripts/**/*.js"
],
"husky": {
"hooks": {
"pre-commit": "npm run lint-staged"
......
const glob = require('glob');
const getPrettierFiles = () => {
let files = [];
const jsFiles = glob.sync('src/**/*.js*', { ignore: ['**/node_modules/**', 'build/**'] });
const tsFiles = glob.sync('src/**/*.ts*', { ignore: ['**/node_modules/**', 'build/**'] });
const configFiles = glob.sync('config/**/*.js*', { ignore: ['**/node_modules/**', 'build/**'] });
const scriptFiles = glob.sync('scripts/**/*.js');
const lessFiles = glob.sync('src/**/*.less*', { ignore: ['**/node_modules/**', 'build/**'] });
files = files.concat(jsFiles);
files = files.concat(tsFiles);
files = files.concat(configFiles);
files = files.concat(scriptFiles);
files = files.concat(lessFiles);
if (!files.length) {
return;
}
return files;
};
module.exports = getPrettierFiles;
......@@ -9,24 +9,12 @@
const glob = require('glob');
const prettier = require('prettier');
const fs = require('fs');
const getPrettierFiles = require('./getPrettierFiles');
const prettierConfigPath = require.resolve('../.prettierrc');
let didError = false;
let files = [];
const jsFiles = glob.sync('src/**/*.js*', { ignore: ['**/node_modules/**', 'build/**'] });
const tsFiles = glob.sync('src/**/*.ts*', { ignore: ['**/node_modules/**', 'build/**'] });
const configFiles = glob.sync('config/**/*.js*', { ignore: ['**/node_modules/**', 'build/**'] });
const scriptFiles = glob.sync('scripts/**/*.js');
const lessFiles = glob.sync('src/**/*.less*', { ignore: ['**/node_modules/**', 'build/**'] });
files = files.concat(jsFiles);
files = files.concat(tsFiles);
files = files.concat(configFiles);
files = files.concat(scriptFiles);
files = files.concat(lessFiles);
if (!files.length) {
return;
}
const files = getPrettierFiles();
files.forEach(file => {
const options = prettier.resolveConfig.sync(file, {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册