build: improve config

This commit is contained in:
Chen Fengyuan 2022-02-02 13:12:02 +08:00
parent c654790a73
commit 800ec9b79e
12 changed files with 17054 additions and 5601 deletions

2
.browserslistrc Normal file
View File

@ -0,0 +1,2 @@
defaults
not ie <= 8

6
.eslintignore Normal file
View File

@ -0,0 +1,6 @@
*.local*
.husky
coverage
dist
docs
node_modules

View File

@ -1,31 +0,0 @@
{
"root": true,
"extends": "airbnb-base",
"env": {
"browser": true
},
"rules": {
"import/no-extraneous-dependencies": "off",
"no-param-reassign": "off",
"no-restricted-properties": "off",
"valid-jsdoc": ["error", {
"requireReturn": false
}]
},
"overrides": [
{
"files": "test/**/*.spec.js",
"env": {
"mocha": true
},
"globals": {
"Viewer": true,
"expect": true
},
"rules": {
"no-new": "off",
"no-unused-expressions": "off"
}
}
]
}

34
.eslintrc.js Normal file
View File

@ -0,0 +1,34 @@
module.exports = {
root: true,
extends: 'airbnb-base',
env: {
browser: true,
},
plugins: [
'import',
],
rules: {
'import/no-extraneous-dependencies': 'off',
'no-param-reassign': 'off',
'no-restricted-properties': 'off',
'valid-jsdoc': ['error', {
requireReturn: false,
}],
},
overrides: [
{
files: 'test/**/*.spec.js',
env: {
mocha: true,
},
globals: {
Viewer: true,
expect: true,
},
rules: {
'no-new': 'off',
'no-unused-expressions': 'off',
},
},
],
};

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
*.local*
*.log
*.map
.DS_Store
coverage
node_modules

6
.stylelintignore Normal file
View File

@ -0,0 +1,6 @@
*.local*
.husky
coverage
dist
docs/css/viewer.css
node_modules

View File

@ -1,10 +0,0 @@
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-order"
],
"rules": {
"no-descending-specificity": null,
"order/properties-alphabetical-order": true
}
}

5
commitlint.config.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
extends: [
'@commitlint/config-conventional',
],
};

4
lint-staged.config.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
'*.js': 'eslint --fix',
'*.{css,scss}': 'stylelint --fix',
};

22484
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,8 @@
"compress:js": "uglifyjs dist/viewer.js -o dist/viewer.min.js -c -m --comments /^!/",
"copy": "cpy dist/viewer.css docs/css",
"lint": "npm run lint:js && npm run lint:css",
"lint:css": "stylelint {src,docs}/**/*.{css,scss,html} --fix",
"lint:js": "eslint src test *.js --fix",
"lint:css": "stylelint **/*.{css,scss} --fix",
"lint:js": "eslint . --fix",
"prepare": "husky install",
"release": "npm run clean && npm run lint && npm run build && npm run compress && npm run copy && npm test",
"start": "npm-run-all --parallel watch:*",
@ -57,58 +57,44 @@
},
"homepage": "https://fengyuanchen.github.io/viewerjs",
"devDependencies": {
"@babel/core": "^7.15.8",
"@babel/preset-env": "^7.15.8",
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@babel/core": "^7.16.12",
"@babel/preset-env": "^7.16.11",
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@rollup/plugin-babel": "^5.3.0",
"babel-plugin-istanbul": "^6.1.1",
"chai": "^4.3.4",
"chai": "^4.3.6",
"change-case": "^4.1.2",
"codecov": "^3.8.3",
"cpy-cli": "^3.1.1",
"create-banner": "^2.0.0",
"cssnano": "^5.0.8",
"cssnano": "^5.0.16",
"del-cli": "^4.0.1",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.25.2",
"eslint": "^8.8.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.4",
"husky": "^7.0.4",
"karma": "^6.3.5",
"karma": "^6.3.13",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-rollup-preprocessor": "^7.0.7",
"lint-staged": "^11.2.3",
"mocha": "^9.1.3",
"lint-staged": "^12.3.3",
"mocha": "^9.2.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.11",
"postcss-cli": "^8.3.1",
"postcss": "^8.4.6",
"postcss-cli": "^9.1.0",
"postcss-header": "^3.0.1",
"postcss-import": "^14.0.2",
"postcss-preset-env": "^6.7.0",
"postcss-preset-env": "^7.3.0",
"postcss-url": "^10.1.3",
"puppeteer": "^10.4.0",
"rollup": "^2.58.0",
"stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0",
"stylelint-order": "^4.1.0",
"uglify-js": "^3.14.2"
},
"browserslist": [
"last 2 versions",
"> 1%",
"not ie <= 8"
],
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"{src,test}/**/*.js|*.conf*.js": "eslint --fix",
"{src,docs}/**/*.{css,scss,html}": "stylelint --fix"
"puppeteer": "^13.1.3",
"rollup": "^2.66.1",
"stylelint": "^14.3.0",
"stylelint-config-standard-scss": "^3.0.0",
"stylelint-order": "^5.0.0",
"uglify-js": "^3.15.0"
}
}

10
stylelint.config.js Normal file
View File

@ -0,0 +1,10 @@
module.exports = {
extends: 'stylelint-config-standard-scss',
plugins: [
'stylelint-order',
],
rules: {
'no-descending-specificity': null,
'order/properties-alphabetical-order': true,
},
};