Browse Source
* fix ts file error for eslint
* add format-imports script
* sort all code
* remove lint:ts
* remove tslint
* remove lint:ts
* up layout
* remove a empty test
* rm tslint config
* use umi config
* prettier all code
* use @umijs/fabric
* [CodeFactor] Apply fixes to commit 69d4f9a
[ci skip] [skip ci]
pull/4536/head
committed by
GitHub
53 changed files with 435 additions and 557 deletions
@ -1,42 +1,12 @@ |
|||
const fabric = require('@umijs/fabric'); |
|||
|
|||
module.exports = { |
|||
parser: 'babel-eslint', |
|||
extends: ['airbnb', 'prettier', 'plugin:compat/recommended'], |
|||
env: { |
|||
browser: true, |
|||
node: true, |
|||
es6: true, |
|||
mocha: true, |
|||
jest: true, |
|||
jasmine: true, |
|||
...fabric.default, |
|||
rules: { |
|||
...fabric.default.rules, |
|||
}, |
|||
globals: { |
|||
page: true, |
|||
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true, |
|||
}, |
|||
rules: { |
|||
'react/jsx-filename-extension': [1, { extensions: ['.js'] }], |
|||
'react/jsx-wrap-multilines': 0, |
|||
'react/prop-types': 0, |
|||
'react/forbid-prop-types': 0, |
|||
'react/jsx-one-expression-per-line': 0, |
|||
'import/no-unresolved': [2, { ignore: ['^@/', '^umi/'] }], |
|||
'import/no-extraneous-dependencies': [ |
|||
2, |
|||
{ |
|||
optionalDependencies: true, |
|||
devDependencies: ['**/tests/**.js', '/mock/**/**.js', '**/**.test.js'], |
|||
}, |
|||
], |
|||
'import/no-cycle': 0, |
|||
'jsx-a11y/no-noninteractive-element-interactions': 0, |
|||
'jsx-a11y/click-events-have-key-events': 0, |
|||
'jsx-a11y/no-static-element-interactions': 0, |
|||
'jsx-a11y/anchor-is-valid': 0, |
|||
'linebreak-style': 0, |
|||
}, |
|||
settings: { |
|||
// support import modules from TypeScript files in JavaScript files
|
|||
'import/resolver': { node: { extensions: ['.js', '.ts', '.tsx'] } }, |
|||
polyfills: ['fetch', 'promises', 'url', 'object-assign'], |
|||
page: true, |
|||
}, |
|||
}; |
|||
|
|||
@ -1,20 +0,0 @@ |
|||
{ |
|||
"singleQuote": true, |
|||
"trailingComma": "all", |
|||
"printWidth": 100, |
|||
"proseWrap": "never", |
|||
"overrides": [ |
|||
{ |
|||
"files": ".prettierrc", |
|||
"options": { |
|||
"parser": "json" |
|||
} |
|||
}, |
|||
{ |
|||
"files": "document.ejs", |
|||
"options": { |
|||
"parser": "html" |
|||
} |
|||
} |
|||
] |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
const fabric = require('@umijs/fabric'); |
|||
|
|||
module.exports = { |
|||
...fabric.prettier, |
|||
}; |
|||
@ -0,0 +1,5 @@ |
|||
const fabric = require('@umijs/fabric'); |
|||
|
|||
module.exports = { |
|||
...fabric.stylelint, |
|||
}; |
|||
@ -1,13 +0,0 @@ |
|||
{ |
|||
"extends": [ |
|||
"stylelint-config-standard", |
|||
"stylelint-config-css-modules", |
|||
"stylelint-config-rational-order", |
|||
"stylelint-config-prettier" |
|||
], |
|||
"plugins": ["stylelint-order", "stylelint-declaration-block-no-ignored-properties"], |
|||
"rules": { |
|||
"no-descending-specificity": null, |
|||
"plugin/declaration-block-no-ignored-properties": true |
|||
} |
|||
} |
|||
@ -1,23 +1,26 @@ |
|||
// eslint-disable-next-line eslint-comments/disable-enable-pair
|
|||
/* eslint-disable import/no-extraneous-dependencies */ |
|||
import generate from '@ant-design/colors/lib/generate'; |
|||
import client from 'webpack-theme-color-replacer/client'; |
|||
import generate from '@ant-design/colors/lib/generate'; |
|||
|
|||
export default { |
|||
lastColor: '#1890ff', |
|||
primaryColor: '#1890ff', |
|||
getAntdSerials(color) { |
|||
getAntdSerials(color: string) { |
|||
// 淡化(即less的tint)
|
|||
const lightens = new Array(9).fill().map((t, i) => { |
|||
return client.varyColor.lighten(color, i / 10); |
|||
}); |
|||
const lightens = new Array(9).fill(0).map((_, i) => client.varyColor.lighten(color, i / 10)); |
|||
const colorPalettes = generate(color); |
|||
return lightens.concat(colorPalettes); |
|||
}, |
|||
changeColor(newColor) { |
|||
changeColor(newColor: string) { |
|||
const lastColor = this.lastColor || this.primaryColor; |
|||
const options = { |
|||
cssUrl: '/css/theme-colors.css', // hash模式下用相对路径
|
|||
oldColors: this.getAntdSerials(lastColor), // current colors array. The same as `matchColors`
|
|||
newColors: this.getAntdSerials(newColor || this.primaryColor), // new colors array, one-to-one corresponde with `oldColors`
|
|||
// hash模式下用相对路径
|
|||
cssUrl: '/css/theme-colors.css', |
|||
// current colors array. The same as `matchColors`
|
|||
oldColors: this.getAntdSerials(lastColor), |
|||
// new colors array, one-to-one corresponde with `oldColors`
|
|||
newColors: this.getAntdSerials(newColor || this.primaryColor), |
|||
}; |
|||
const promise = client.changer.changeColor(options, Promise); |
|||
this.lastColor = lastColor; |
|||
@ -1,88 +0,0 @@ |
|||
defaultSeverity: error |
|||
globals: |
|||
- ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true |
|||
extends: |
|||
- tslint-react |
|||
- tslint-eslint-rules |
|||
- tslint-config-prettier |
|||
jsRules: |
|||
rules: |
|||
class-name: true |
|||
eofline: true |
|||
forin: true |
|||
jsdoc-format: false |
|||
label-position: true |
|||
member-ordering: |
|||
- true |
|||
- order: statics-first |
|||
new-parens: true |
|||
no-arg: true |
|||
no-bitwise: true |
|||
no-conditional-assignment: true |
|||
no-consecutive-blank-lines: true |
|||
no-construct: true |
|||
no-debugger: true |
|||
no-duplicate-variable: true |
|||
no-eval: true |
|||
no-internal-module: true |
|||
no-multi-spaces: true |
|||
no-namespace: true |
|||
no-reference: true |
|||
no-shadowed-variable: true |
|||
no-string-literal: true |
|||
no-trailing-whitespace: true |
|||
no-unused-expression: true |
|||
no-var-keyword: true |
|||
one-variable-per-declaration: |
|||
- true |
|||
- ignore-for-loop |
|||
prefer-const: |
|||
- true |
|||
- destructuring: all |
|||
radix: true |
|||
space-in-parens: true |
|||
switch-default: true |
|||
trailing-comma: |
|||
- true |
|||
- singleline: never |
|||
multiline: always |
|||
esSpecCompliant: true |
|||
triple-equals: |
|||
- true |
|||
- allow-null-check |
|||
typedef-whitespace: |
|||
- true |
|||
- call-signature: nospace |
|||
index-signature: nospace |
|||
parameter: nospace |
|||
property-declaration: nospace |
|||
variable-declaration: nospace |
|||
- call-signature: onespace |
|||
index-signature: onespace |
|||
parameter: onespace |
|||
property-declaration: onespace |
|||
variable-declaration: onespace |
|||
use-isnan: true |
|||
variable-name: |
|||
- true |
|||
- allow-leading-underscore |
|||
- ban-keywords |
|||
- check-format |
|||
- allow-pascal-case |
|||
jsx-no-lambda: false |
|||
jsx-no-string-ref: false |
|||
jsx-boolean-value: |
|||
- true |
|||
- never |
|||
jsx-no-multiline-js: false |
|||
whitespace: |
|||
- true |
|||
- check-branch |
|||
- check-decl |
|||
- check-operator |
|||
- check-module |
|||
- check-separator |
|||
- check-rest-spread |
|||
- check-type |
|||
- check-type-operator |
|||
- check-preblock |
|||
Loading…
Reference in new issue