Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ineo6/eslint-config-magic
统一的 ESLint 配置规范。
https://github.com/ineo6/eslint-config-magic
eslint eslint-plugin javascript
Last synced: 4 months ago
JSON representation
统一的 ESLint 配置规范。
- Host: GitHub
- URL: https://github.com/ineo6/eslint-config-magic
- Owner: ineo6
- Created: 2019-06-24T09:10:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-04-28T04:06:08.000Z (almost 3 years ago)
- Last Synced: 2024-10-11T22:20:40.539Z (4 months ago)
- Topics: eslint, eslint-plugin, javascript
- Language: JavaScript
- Homepage: https://ineo6.github.io/eslint-config-magic/
- Size: 908 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Magic ESLint 规则
统一 ESLint 配置规范。
## 使用方法
### 标准规则
```shell
npm install eslint@7 @babel/core @babel/eslint-parser eslint-config-magic --save-dev
```在你的项目根目录下创建 `.eslintrc.js`,并将以下内容复制到文件中:
```js
module.exports = {
extends: [
'magic',
],
globals: {
// 这里填入你的项目需要的全局变量
// 这里值为 false 表示这个全局变量不允许被重新赋值,比如:
//
// jQuery: false,
// $: false
},
rules: {
// 这里填入你的项目需要的个性化配置:
},
};
```### React
```shell
npm install eslint@7 @babel/core @babel/eslint-parser @babel/preset-react@latest eslint-plugin-react eslint-config-magic --save-dev
```在你的项目根目录下创建 `.eslintrc.js`,并将以下内容复制到文件中:
```js
module.exports = {
extends: [
'magic',
'magic/react',
],
rules: {
// 这里填入你的项目需要的个性化配置:
},
};
```### Vue 2
```shell
npm install eslint@7 @babel/core @babel/eslint-parser vue-eslint-parser eslint-plugin-vue eslint-config-magic --save-dev
```在你的项目根目录下创建 `.eslintrc.js`,并将以下内容复制到文件中:
```js
module.exports = {
extends: [
'magic',
'magic/vue',
],
rules: {
// 这里填入你的项目需要的个性化配置:
},
};
```### TypeScript React
```shell
npm install eslint@7 typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-config-magic --save-dev
```在你的项目根目录下创建 `.eslintrc.js`,并将以下内容复制到文件中:
```js
module.exports = {
extends: [
'magic',
'magic/react',
'magic/typescript',
],
rules: {
// 这里填入你的项目需要的个性化配置:
},
};
```### JS + TS 混合(React)
```shell
npm install eslint@7 @babel/core @babel/eslint-parser typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-config-magic --save-dev
``````js
module.exports = {
'extends': [
'magic',
'magic/react',
],
'rules': {
},
'overrides': [
{
'files': [
'**/*.ts',
'**/*.tsx',
],
'extends': [
'magic/typescript',
],
'rules': {},
},
],
};
```### TypeScript
```shell
npm install eslint@7 typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-config-magic --save-dev
```在你的项目根目录下创建 `.eslintrc.js`,并将以下内容复制到文件中:
```js
module.exports = {
extends: [
'magic',
'magic/typescript',
],
rules: {
// 这里填入你的项目需要的个性化配置:
},
};
```