config: use prettier as default formatter and format some configs

This commit is contained in:
Sagi 2022-09-13 17:32:51 +08:00
parent 6b27372b15
commit 3586a73ede
4 changed files with 105 additions and 107 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode"
}

View File

@ -1,7 +1,7 @@
const types = ['config','feature', 'fix', 'docs', 'style', 'refactor', 'performance', 'test', 'build', 'release', 'chore', 'revert'];
const types = ['config', 'feature', 'fix', 'docs', 'style', 'refactor', 'performance', 'test', 'build', 'release', 'chore', 'revert'];
module.exports = {
parserPreset: {parserOpts: {headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/}},
parserPreset: { parserOpts: { headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/ } },
extends: ['@commitlint/config-conventional'],
rules: {
'type-empty': [2, 'never'],
@ -16,7 +16,7 @@ module.exports = {
type: {
description: "Select the type of change that you're committing",
enum: {
config:{
config: {
description: 'Changes that affect the tools, such as eslint, npm, vscode.',
title: 'Config',
emoji: '🛠',
@ -37,14 +37,12 @@ module.exports = {
emoji: '📚',
},
style: {
description:
'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
description: 'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
title: 'Styles',
emoji: '💎',
},
refactor: {
description:
'A code change that neither fixes a bug nor adds a feature',
description: 'A code change that neither fixes a bug nor adds a feature',
title: 'Code Refactoring',
emoji: '📦',
},
@ -59,14 +57,12 @@ module.exports = {
emoji: '🚨',
},
build: {
description:
'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
description: 'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
title: 'Builds',
emoji: '🛠',
},
ci: {
description:
'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
description: 'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
title: 'Continuous Integrations',
emoji: '⚙️',
},
@ -79,16 +75,14 @@ module.exports = {
description: 'Reverts a previous commit',
title: 'Reverts',
emoji: '🗑',
}
}
},
},
},
scope: {
description:
'What is the scope of this change (e.g. component or file name)',
description: 'What is the scope of this change (e.g. component or file name)',
},
subject: {
description:
'Write a short, imperative tense description of the change',
description: 'Write a short, imperative tense description of the change',
},
body: {
description: 'Provide a longer description of the change',
@ -97,8 +91,7 @@ module.exports = {
description: 'Are there any breaking changes?',
},
breakingBody: {
description:
'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself',
description: 'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself',
},
breaking: {
description: 'Describe the breaking changes',
@ -107,12 +100,11 @@ module.exports = {
description: 'Does this change affect any open issues?',
},
issuesBody: {
description:
'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself',
description: 'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself',
},
issues: {
description: 'Add issue references (e.g. "fix #123", "re #123".)',
},
},
}
},
};

View File

@ -27,8 +27,10 @@
"stylelint-scss": "^3.3.1"
},
"lint-staged": {
"packages/**/{*.vue,*.js,*.ts,*.jsx,*.tsx}": "eslint --fix",
"packages/**/{*.scss,*.css}": "stylelint --fix"
"packages/docs-vue/{*.vue,*.js,*.ts,*.jsx,*.tsx}": "eslint --fix",
"packages/docs-vue/{*.scss,*.css}": "stylelint --fix",
"packages/ui-vue/{*.vue,*.js,*.ts,*.jsx,*.tsx}": "eslint --fix",
"packages/ui-vue/{*.scss,*.css}": "stylelint --fix"
},
"workspaces": [
"packages/*"

View File

@ -11,7 +11,8 @@
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
"forceConsistentCasingInFileNames": true
},
"include": ["**/*.ts", "**/*.tsx", "**/*.vue"],
"exclude": ["node_modules"]