-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(lerna): update README * feat(vscode): add vscode settings * feat: add rules and plugins for base config * feat: add react config * feat: use independent version for lerna * feat: add useage * chore(vscode): update eslint settings * chore(npm): add lerna-changelog * chore: add lerna-changelog script
- Loading branch information
Showing
32 changed files
with
8,257 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"eslint.validate": [ | ||
{ "language": "javascript", "autoFix": true }, | ||
{ "language": "javascriptreact", "autoFix": true }, | ||
{ "language": "typescript", "autoFix": true }, | ||
{ "language": "typescriptreact", "autoFix": true } | ||
], | ||
"cSpell.words": [ | ||
"mjolnir" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# mjolnir | ||
# mjolnir [](https://lerna.js.org/) | ||
|
||
A tool for FrondEnd Developer, same as the "Thor Hammer". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
{ | ||
"changelog": { | ||
"repo": "mjolnirjs/mjolnir", | ||
"cacheDir": ".changelog" | ||
}, | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "0.0.0" | ||
"npmClient": "yarn", | ||
"version": "independent" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
extends: [ | ||
'./node.js', | ||
"plugin:prettier/recommended" | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
**/*.md | ||
**/*.svg | ||
**/*.ejs | ||
**/*.html | ||
package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"printWidth": 80, | ||
"singleQuote": true, | ||
"arrowParens": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# @mjolnir/eslint-config | ||
|
||
适用于 node/es/ts/react 环境下的 eslint 配置集合。 | ||
|
||
## 使用说明 | ||
按环境区分使用 | ||
|
||
### es6 (默认) | ||
`npm i -D @mjolnir/eslint-config eslint eslint-plugin-import` | ||
|
||
#### 配置 | ||
```json | ||
{ | ||
"extends": [ | ||
"@mjolnir/eslint-config" | ||
] | ||
} | ||
``` | ||
|
||
|
||
### Node.js | ||
`npm i -D @mjolnir/eslint-config eslint eslint-plugin-node` | ||
|
||
#### 配置 | ||
```json | ||
{ | ||
"extends": [ | ||
"@mjolnir/eslint-config/node" | ||
] | ||
} | ||
``` | ||
|
||
### Babel (ES) | ||
`npm i -D @mjolnir/eslint-config eslint eslint-plugin-import babel-eslint eslint-plugin-babel` | ||
|
||
#### 配置 | ||
```json | ||
{ | ||
"extends": [ | ||
"@mjolnir/eslint-config/babel" | ||
] | ||
} | ||
``` | ||
|
||
### TypeScript | ||
`npm i -D @mjolnir/eslint-config eslint eslint-plugin-import @typescript-eslint/parser @typescript-eslint/eslint-plugin` | ||
|
||
#### 配置 | ||
```json | ||
{ | ||
"extends": [ | ||
"@mjolnir/eslint-config/typescript" | ||
] | ||
} | ||
``` | ||
|
||
### React | ||
`npm i -D @mjolnir/eslint-config eslint eslint-plugin-import babel-eslint eslint-plugin-babel eslint-plugin-react eslint-plugin-react-hook` | ||
|
||
#### 配置 | ||
```json | ||
{ | ||
"extends": [ | ||
"@mjolnir/eslint-config/babel", | ||
"@mjolnir/eslint-config/react" | ||
] | ||
} | ||
``` | ||
|
||
|
||
|
||
### React with TypeScript | ||
`npm i -D @mjolnir/eslint-config eslint eslint-plugin-import @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hook` | ||
|
||
#### 配置 | ||
```json | ||
{ | ||
"extends": [ | ||
"@mjolnir/eslint-config/typescript", | ||
"@mjolnir/eslint-config/react" | ||
] | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
extends: [ | ||
'./index', // 基于 es6 的配置 | ||
'./plugins/babel' | ||
].map(require.resolve) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// for es6 env | ||
module.exports = { | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
}, | ||
env: { | ||
browser: true, | ||
es6: true | ||
}, | ||
extends: ['./rules', './plugins/import'].map(require.resolve) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// for nodejs env, support es6+ syntax | ||
module.exports = { | ||
extends: ['./rules', './plugins/node'].map(require.resolve) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "@mjolnir/eslint-config", | ||
"version": "0.0.1", | ||
"description": "eslint config collect", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mjolnirjs/mjolnir/tree/master/packages/eslint-config" | ||
}, | ||
"homepage": "https://github.com/mjolnirjs/mjolnir/tree/master/packages/eslint-config", | ||
"bugs": { | ||
"url": "https://github.com/mjolnirjs/mjolnir/issues" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"config", | ||
"airbnb", | ||
"javascript" | ||
], | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"eslint": "^5.16.0", | ||
"eslint-plugin-node": "^9.1.0", | ||
"eslint-config-prettier": "^4.3.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"prettier": "^1.17.1" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^5.16.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// eslint-plugin-babel has no recommend config | ||
module.exports = { | ||
parser: 'babel-eslint', | ||
plugins: ['babel'], | ||
rules: {} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = { | ||
plugins: ['import'], | ||
rules: { | ||
// analysis/correctness | ||
'import/no-unresolved': 'error', | ||
'import/named': 'error', | ||
'import/namespace': 'error', | ||
'import/default': 'error', | ||
'import/export': 'error', | ||
|
||
// red flags (thus, warnings) | ||
'import/no-named-as-default': 'warn', | ||
'import/no-named-as-default-member': 'warn', | ||
'import/no-duplicates': 'warn' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
module.exports = { | ||
extends: ['plugin:node/recommended'], | ||
rules: { | ||
// enforce return after a callback | ||
'callback-return': 'off', | ||
|
||
// require all requires be top-level | ||
// https://eslint.org/docs/rules/global-require | ||
'global-require': 'error', | ||
|
||
// enforces error handling in callbacks (node environment) | ||
'handle-callback-err': 'off', | ||
|
||
// disallow use of the Buffer() constructor | ||
// https://eslint.org/docs/rules/no-buffer-constructor | ||
'no-buffer-constructor': 'error', | ||
|
||
// disallow mixing regular variable and require declarations | ||
'no-mixed-requires': ['off', false], | ||
|
||
// disallow use of new operator with the require function | ||
'no-new-require': 'error', | ||
|
||
// disallow string concatenation with __dirname and __filename | ||
// https://eslint.org/docs/rules/no-path-concat | ||
'no-path-concat': 'error', | ||
|
||
// disallow use of process.env | ||
'no-process-env': 'off', | ||
|
||
// disallow process.exit() | ||
'no-process-exit': 'off', | ||
|
||
// restrict usage of specified node modules | ||
'no-restricted-modules': 'off', | ||
|
||
// disallow use of synchronous methods (off by default) | ||
'no-sync': 'off' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
plugins: ['react-hooks'], | ||
rules: { | ||
'react-hooks/exhaustive-deps': 'warn', | ||
'react-hooks/rules-of-hooks': 'error' | ||
} | ||
}; |
Oops, something went wrong.