Skip to content

Commit

Permalink
feat: typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
ubbcou committed Aug 1, 2021
1 parent 6cec70c commit d48c31a
Show file tree
Hide file tree
Showing 8 changed files with 1,678 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
semi: [2, 'never'],
quotes: ['error', 'single'],
camelcase: 'off',
'eslint no-trailing-spaces': 'error',
'no-trailing-spaces': 'error',
'eol-last': ["error", "always"],
'comma-dangle': ['error', 'always-multiline'],
'no-underscore-dangle': 'off',
Expand Down
Empty file.
31 changes: 31 additions & 0 deletions packages/typescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# eslint config for javascript

## 使用方法

### 安装

```bash
yarn add -D eslint @ubbcou/eslint-config-base
```

### 配置

```js
// .eslintrc.js
module.exports = {
extends: [
'@ubbcou/typescript',
],
}
```

## 注意

`vscode` 保存代码时自动修复eslint错误

```json
// setting
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
```
34 changes: 34 additions & 0 deletions packages/typescript/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
extends: [
'@ubbcou/base',
'plugin:@typescript-eslint/recommended',
],
rules: {
// TS
'no-useless-constructor': 'off',
'@typescript-eslint/semi': ['error', 'never'],
'@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],
'@typescript-eslint/type-annotation-spacing': ['error', {}],

'indent': 'off',
'@typescript-eslint/indent': ['error', 2],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',

// off
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off',
},
}
35 changes: 35 additions & 0 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@ubbcou/eslint-config-typescript",
"version": "0.3.0",
"description": "",
"main": "index.js",
"files": [
"index.js"
],
"scripts": {
"lint": "eslint . --config=index.js"
},
"repository": {
"type": "git",
"url": "git@github.com:ubbcou/eslint-config.git",
"directory": "packages/typescript"
},
"peerDependencies": {
"eslint": ">=7.4.0",
"typescript": ">=3.9"
},
"keywords": [],
"author": "ubbcou <ubbcou@outlook.com> (http://github.com/ubbcou)",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.1",
"@ubbcou/eslint-config-base": "^0.4.0"
},
"devDependencies": {
"eslint": "^7.30.0"
}
}
Loading

0 comments on commit d48c31a

Please sign in to comment.