ssc-eslint v2.1.9
Ssc Eslint ·
English | 简体中文
SSC code style is unified and the project is uniformly configured
Features
- 代码风格统一,项目统一配置 ESLint/Prettier/Husky/EditorConfig
- 配置 Commit message, 使用标准 commit 生成 changelog 标准化
Installation
# or pnpm or yarn
npm install ssc-eslint --save-dev
# exegesis:npx stands for Find command from current path, ./node_modules/.bin/ssc-eslint init
npx ssc-eslint init
Code Specification
ESLint:ESLint
Prettier makes writing code in one consistent style automatic, painless and so much easier. No need to spend so much time, effort and mental energy discussing styles or formatting your code. Simply press save and your code is formatted.
.eslintrc.js
rules
Configuration Instructions Reference:eslint docs rules
Prettier:Prettier
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary
.prettierrc.js
Configuration Instructions Reference:prettier docs
Stylelint:Stylelint
A mighty CSS linter that helps you avoid errors and enforce conventions.
.stylelintrc.js
rules
Configuration Instructions Reference:stylelintrc docs rules
Husky:Husky
Husky is an NPM package that lets you run a set of commands or script before any git action. For eg pre-push, pre-commit, pre-rebase.
Commitlint: Commitlint
helps your team adhere to a commit convention. By supporting npm-installed configurations it makes sharing of commit conventions easy.
EditorConfig:EditorConfig
EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.
CSS Modules
A CSS Module is a CSS file in which all class names and animation names are scoped locally by default.
Conventional Commits
Commit message changelog
- The commit message should be structured as follows:
<type>[optional scope]: <description>
<BLANK LINE>
[optional body]
<BLANK LINE>
[optional footer(s)]
"type-enum": "build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test"
type-enum documentation:
type | description |
---|---|
feat (feature ) | Add features Introduce new features |
fix | Bug fix Fix |
perf | Performance Optimization Change code to improve performance |
style | Formatting changes that do not affect the meaning of the code (spaces, missing semicolons in formatting, etc.) |
docs | Document Changes Add or update documents |
refactor | Code refactoring is not about fixing 'bugs' or adding code changes to features |
test | Update Tests Add or update tests |
ci | 脚本变更 对 CI 配置文件和脚本的更改(示例作用域: Travis, Circle , BrowserStack , SauceLabs ) |
build | 依赖调整 影响构建系统或外部依赖的更改 (示例作用域:gulp , broccoli , npm , vite , webpack ) |
revert | Recovery version; Revert to the previous version |
chore | Miscellaneous processing Other changes that do not modify the source file or the test file |
Exception handling
run:npm install ssc-eslint --save-dev
after warning Peer dependencies that should be installed:
Scheme A
To resolve the above error, you can run the following command
- run:
pnpm config set auto-install-peers true
会在在当前项目目录下会生成一个.npmrc
文件,并生成以下配置(如若未生成对应文件,可手动生成,并设置以下内容)
auto-install-peers = true;
- delete
node_modules
folder; - Restart the compiler;
- npm install;
Scheme B
- 根据提示(
Peer dependencies that should be installed:
)进行install
PeerDependencies
中的依赖项;
Directory
# pnpm or yarn
npm install directory-doc -g
directory-doc init
# ssc-eslint directory
|-- .git ---------------------------------- #
|-- .husky ---------------------------------- #
| |-- _ ---------------------------------- #
| | |-- .gitignore ---------------------------------- #
| | |-- husky.sh ---------------------------------- #
| |-- pre-commit ---------------------------------- #
|-- .vscode ---------------------------------- #
| |-- settings.json ---------------------------------- #
|-- bin ---------------------------------- #
| |-- ssc-eslint.js ---------------------------------- #
|-- node_modules ---------------------------------- #
|-- src ---------------------------------- #
| |-- conf ---------------------------------- #
| | |-- .eslintignore ---------------------------------- #
| | |-- .eslintrc.js ---------------------------------- #
| | |-- .prettierignore ---------------------------------- #
| | |-- .prettierrc.js ---------------------------------- #
| | |-- .stylelintignore ---------------------------------- #
| | |-- .stylelintrc.js ---------------------------------- #
| |-- utils ---------------------------------- #
| | |-- common.js ---------------------------------- #
| | |-- error.js ---------------------------------- #
| | |-- write.js ---------------------------------- #
| |-- index.js ---------------------------------- #
|-- .eslintignore ---------------------------------- #
|-- .eslintrc.js ---------------------------------- #
|-- .gitignore ---------------------------------- #
|-- .npmignore ---------------------------------- #
|-- .prettierignore ---------------------------------- #
|-- .prettierrc.js ---------------------------------- #
|-- .stylelintignore ---------------------------------- #
|-- .stylelintrc.js ---------------------------------- #
|-- jest.config.js ---------------------------------- #
|-- package.json ---------------------------------- #
|-- pnpm-lock.yaml ---------------------------------- #
|-- README.md ---------------------------------- #
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago