Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ yarn-error.log*

# misc
.DS_Store

yarn.lock
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
## INSTALL

```bash
# npx 会自动识别 npm/yarn
npx install-peerdeps @arkrm/bionic -D
# install with yarn
yarn add @arkrm/bionic -D

# install with npm
npm i @arkrm/bionic -D
```

## USEAGE
Expand All @@ -33,9 +36,32 @@ module.exports = {
};

// .prettierrc.js
module.exports = require('@arkrm/bionic/prettier');;
module.exports = require('@arkrm/bionic/prettier');
```

## TIPS

+ [taro](https://github.com/nervjs/taro) 仅适用于 `>=3.x` 版本,且上层框架为 `react`
+ [taro](https://github.com/nervjs/taro) 仅适用于 `>=3.x` 版本,且上层框架为 `react`

## VSCode config example

```json
// .vscode/settings.json
{
"eslint.validate": ["javascript", "typescript", "typescriptreact"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[javascript]": {
"editor.formatOnSave": false
},
"[typescript]": {
"editor.formatOnSave": false
},
"[typescriptreact]": {
"editor.formatOnSave": false
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
}
```
16 changes: 11 additions & 5 deletions eslint/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ module.exports = {
jasmine: true,
},
parser: require.resolve('@typescript-eslint/parser'),
plugins: ['@typescript-eslint'],
extends: ['airbnb', 'airbnb/hooks', 'plugin:prettier/recommended', 'prettier/react', 'prettier/@typescript-eslint'],
plugins: ['jest'],
extends: [
'airbnb',
'airbnb-typescript',
'airbnb/hooks',
'plugin:prettier/recommended',
'prettier/react',
'prettier/@typescript-eslint'
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
project: './tsconfig.json',
ecmaFeatures: {
jsx: true,
},
useJSXTextNode: true,
warnOnUnsupportedTypeScriptVersion: true,
warnOnUnsupportedTypeScriptVersion: false,
},
root: true,
settings: {
Expand Down
1 change: 1 addition & 0 deletions eslint/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ module.exports = {
'no-useless-constructor': 'off',
'react/button-has-type': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['js', 'jsx', 'ts', 'tsx'] }],
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
'react/prop-types': 'off',
Expand Down
1 change: 0 additions & 1 deletion eslint/taro.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const forbidElements = htmlTags.map((tag) => ({

module.exports = Object.assign({}, require('./base'), {
rules: Object.assign({}, rules, {
'class-methods-use-this': 'off',
'react/forbid-elements': ['error', { forbid: forbidElements }],
}),
});
28 changes: 15 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkrm/bionic",
"version": "4.1.1",
"version": "5.0.0",
"author": "vdfor",
"keywords": [
"qurak",
Expand Down Expand Up @@ -33,18 +33,20 @@
"release:next": "yarn publish --tag=next",
"release:beta": "yarn publish --tag=beta"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^3.6.1",
"@typescript-eslint/parser": "^3.6.1",
"eslint": "^7.4.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"eslint": "^7.14.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-typescript": "^12.0.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.8",
"prettier": "^2.0.5",
"typescript": "^3.9.7"
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"prettier": "^2.2.0",
"typescript": "^4.0.0"
}
}
2 changes: 1 addition & 1 deletion prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
},
},
],
printWidth: 150,
printWidth: 200,
singleQuote: true,
trailingComma: 'all',
};
Loading