Skip to content

Commit

Permalink
feat(初始化仓库): 初始化规范化配置 monorepo配置
Browse files Browse the repository at this point in the history
affects: @varlet/cli, @varlet/eslint-config, @varlet/stylelint-config

初始化eslint,tsconfig,stylelint,lerna,yarn workspace,prettier,husky,lint-staged,commitlint配置
  • Loading branch information
haoziqaq committed Oct 30, 2020
0 parents commit 5913d0b
Show file tree
Hide file tree
Showing 15 changed files with 8,136 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules

.idea
*.log

packages/viti-cli/lib
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"useTabs": true,
"tabWidth": 2,
"singleQuote": true,
"semi": false
}
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
}
16 changes: 16 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"packages": [
"packages/*"
],
"useWorkspaces": true,
"npmClient": "yarn",
"command": {
"version": {
"conventionalCommits": true
}
},
"ignoreChanges": [
"**/*.md"
],
"version": "0.0.2"
}
57 changes: 57 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "root",
"private": true,
"useWorkspaces": true,
"version": "0.0.0",
"author": "haoziqaq <[email protected]>",
"main": "index.js",
"npmClient": "yarn",
"workspaces": [
"packages/*"
],
"license": "MIT",
"scripts": {
"bootstrap": "yarn || npm i",
"commit": "git-cz",
"publish": "lerna publish"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-lerna-changelog"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*.md": "prettier --write",
"*.{ts,tsx,js,vue,scss}": "prettier --write",
"*.{ts,tsx,js,vue}": "eslint --fix",
"*.{vue,css,scss}": "stylelint --fix"
},
"eslintConfig": {
"root": true,
"extends": [
"@varlet"
]
},
"stylelint": {
"extends": [
"varlet-stylelint-config"
]
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"commitizen": "^4.2.2",
"cz-lerna-changelog": "^2.0.3",
"husky": "^4.3.0",
"lerna": "^3.22.1",
"lint-staged": "^10.5.0",
"prettier": "^2.1.2",
"typescript": "^4.0.5"
}
}
4 changes: 4 additions & 0 deletions packages/varlet-cli/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare const a: string;
declare const b: {
a: number;
};
3 changes: 3 additions & 0 deletions packages/varlet-cli/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";
const a = 'ssss222222111112222';
const b = { a: 2 };
24 changes: 24 additions & 0 deletions packages/varlet-cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@varlet/cli",
"version": "0.0.0",
"private": false,
"description": "cli of varlet",
"keywords": [
"cli",
"varlet"
],
"author": "haoziqaq <[email protected]>",
"license": "MIT",
"main": "lbd/index.js",
"files": [
"lib"
],
"repository": {
"type": "git",
"url": "https://github.com/haoziqaq/varlet.git"
},
"scripts": {
"dev": "tsc --watch"
},
"gitHead": "6a34fb715e3540af46aeb4e123f69b92ee431938"
}
2 changes: 2 additions & 0 deletions packages/varlet-cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const a = 'ssss222222111112222'
const b = [1, 1, 1, 1, 1, 1, 1]
16 changes: 16 additions & 0 deletions packages/varlet-cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"outDir": "./lib",
"target": "esnext",
"module": "commonjs",
"sourceMap": false,
"strict": true,
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"]
},
"include": [
"src/**/*"
]
}
61 changes: 61 additions & 0 deletions packages/varlet-eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
module.exports = {
extends: [
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
'prettier',
'prettier/vue',
],
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2020,
sourceType: 'module',
extraFileExtensions: ['.vue'],
},
plugins: ['@typescript-eslint'],
env: {
es6: true,
node: true,
browser: true,
},
rules: {
'no-new': 'off',
'no-shadow': 'off',
'no-bitwise': 'off',
'func-names': 'off',
'no-console': 'off',
'no-plusplus': 'off',
'default-case': 'off',
'prefer-template': 'off',
'consistent-return': 'off',
'no-param-reassign': 'off',
'no-nested-ternary': 'off',
'no-underscore-dangle': 'off',
'no-unused-expressions': 'off',
'no-restricted-globals': 'off',
'class-methods-use-this': 'off',
'prefer-destructuring': ['error', { object: true, array: false }],
// eslint-plugin-import
'import/order': 'off',
'import/extensions': 'off',
'import/no-unresolved': 'off',
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': 'off',
// eslint-plugin-vue
'vue/no-v-html': 'off',
'vue/attributes-order': 'off',
'vue/require-v-for-key': 'off',
'vue/require-default-prop': 'off',
'vue/no-unused-components': 'off',
'vue/name-property-casing': ['error', 'kebab-case'],
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
// typescript-eslint
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
},
};
31 changes: 31 additions & 0 deletions packages/varlet-eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@varlet/eslint-config",
"version": "0.0.0",
"description": "eslint config of viti",
"keywords": [
"eslint",
"tslint",
"config",
"viti"
],
"author": "haoziqaq <[email protected]>",
"license": "MIT",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/haoziqaq/varlet.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0",
"eslint": "^7.12.1",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-vue": "^7.1.0"
},
"gitHead": "6a34fb715e3540af46aeb4e123f69b92ee431938"
}
6 changes: 6 additions & 0 deletions packages/varlet-stylelint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-prettier'
]
}
22 changes: 22 additions & 0 deletions packages/varlet-stylelint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@varlet/stylelint-config",
"version": "0.0.0",
"description": "stylelint config of varlet",
"keywords": [
"stylelint",
"varlet"
],
"author": "haoziqaq <[email protected]>",
"license": "MIT",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/haoziqaq/varlet.git"
},
"dependencies": {
"stylelint": "^13.7.2",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-standard": "^20.0.0"
},
"gitHead": "6a34fb715e3540af46aeb4e123f69b92ee431938"
}
Loading

0 comments on commit 5913d0b

Please sign in to comment.