mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
fixed prettier, eslint?
This commit is contained in:
parent
3eafd990cb
commit
3413b22ac2
6 changed files with 70 additions and 20 deletions
17
.eslintrc.js
17
.eslintrc.js
|
@ -1,21 +1,21 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: ['airbnb', 'airbnb-base', 'plugin:@typescript-eslint/recommended'],
|
extends: ['airbnb', 'airbnb-base', 'plugin:@typescript-eslint/recommended', 'prettier'],
|
||||||
// "parser": "babel-eslint",
|
// "parser": "babel-eslint",
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaFeatures: {
|
ecmaFeatures: {
|
||||||
jsx: true,
|
jsx: true
|
||||||
},
|
},
|
||||||
project: './tsconfig.json',
|
project: './tsconfig.json'
|
||||||
},
|
},
|
||||||
plugins: ['@typescript-eslint', 'react', 'jsx-a11y', 'import', 'react-hooks'],
|
plugins: ['@typescript-eslint', 'react', 'jsx-a11y', 'import', 'react-hooks', 'prettier'],
|
||||||
settings: {
|
settings: {
|
||||||
'import/resolver': {
|
'import/resolver': {
|
||||||
// node: {
|
// node: {
|
||||||
// extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
// extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||||
// },
|
// },
|
||||||
typescript: {},
|
typescript: {}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
indent: ['error', 2],
|
indent: ['error', 2],
|
||||||
|
@ -48,11 +48,12 @@ module.exports = {
|
||||||
'import/prefer-default-export': 0,
|
'import/prefer-default-export': 0,
|
||||||
'no-return-await': 0,
|
'no-return-await': 0,
|
||||||
'prefer-promise-reject-errors': 0,
|
'prefer-promise-reject-errors': 0,
|
||||||
|
'import/order': 0
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
document: false,
|
document: false,
|
||||||
window: false,
|
window: false,
|
||||||
HTMLInputElement: false,
|
HTMLInputElement: false,
|
||||||
HTMLDivElement: false,
|
HTMLDivElement: false
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
4
.prettierrc
Normal file
4
.prettierrc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"printWidth": 120,
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
47
package-lock.json
generated
47
package-lock.json
generated
|
@ -7272,6 +7272,23 @@
|
||||||
"object.entries": "^1.1.0"
|
"object.entries": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"eslint-config-prettier": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-vDrcCFE3+2ixNT5H83g28bO/uYAwibJxerXPj+E7op4qzBCsAV36QfvdAyVOoNxKAH2Os/e01T/2x++V0LPukA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"get-stdin": "^6.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"get-stdin": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"eslint-import-resolver-babel-module": {
|
"eslint-import-resolver-babel-module": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-import-resolver-babel-module/-/eslint-import-resolver-babel-module-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-import-resolver-babel-module/-/eslint-import-resolver-babel-module-4.0.0.tgz",
|
||||||
|
@ -7520,6 +7537,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"eslint-plugin-prettier": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"prettier-linter-helpers": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"eslint-plugin-react": {
|
"eslint-plugin-react": {
|
||||||
"version": "7.14.3",
|
"version": "7.14.3",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz",
|
||||||
|
@ -7989,6 +8015,12 @@
|
||||||
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
|
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"fast-diff": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"fast-json-stable-stringify": {
|
"fast-json-stable-stringify": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||||
|
@ -13627,6 +13659,21 @@
|
||||||
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
|
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"prettier": {
|
||||||
|
"version": "1.18.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
|
||||||
|
"integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"prettier-linter-helpers": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"fast-diff": "^1.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"pretty-error": {
|
"pretty-error": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz",
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
"css-loader": "^0.28.11",
|
"css-loader": "^0.28.11",
|
||||||
"eslint": "^5.16.0",
|
"eslint": "^5.16.0",
|
||||||
"eslint-config-airbnb": "^17.1.1",
|
"eslint-config-airbnb": "^17.1.1",
|
||||||
|
"eslint-config-prettier": "^6.0.0",
|
||||||
"eslint-import-resolver-babel-module": "^4.0.0",
|
"eslint-import-resolver-babel-module": "^4.0.0",
|
||||||
"eslint-import-resolver-typescript": "^1.1.1",
|
"eslint-import-resolver-typescript": "^1.1.1",
|
||||||
"eslint-import-resolver-webpack": "^0.9.0",
|
"eslint-import-resolver-webpack": "^0.9.0",
|
||||||
|
@ -36,6 +37,7 @@
|
||||||
"eslint-plugin-babel": "^5.3.0",
|
"eslint-plugin-babel": "^5.3.0",
|
||||||
"eslint-plugin-import": "^2.18.2",
|
"eslint-plugin-import": "^2.18.2",
|
||||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
"eslint-plugin-jsx-a11y": "^6.2.3",
|
||||||
|
"eslint-plugin-prettier": "^3.1.0",
|
||||||
"eslint-plugin-react": "^7.14.3",
|
"eslint-plugin-react": "^7.14.3",
|
||||||
"file-loader": "^1.1.11",
|
"file-loader": "^1.1.11",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
|
@ -44,6 +46,7 @@
|
||||||
"mini-css-extract-plugin": "^0.5.0",
|
"mini-css-extract-plugin": "^0.5.0",
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
|
"prettier": "^1.18.2",
|
||||||
"resolve-url-loader": "^3.0.1",
|
"resolve-url-loader": "^3.0.1",
|
||||||
"style-loader": "^0.21.0",
|
"style-loader": "^0.21.0",
|
||||||
"ts-node": "^8.0.1",
|
"ts-node": "^8.0.1",
|
||||||
|
|
|
@ -10,10 +10,7 @@ export const IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/
|
||||||
export function createUploader<T extends {}, R extends {}>(
|
export function createUploader<T extends {}, R extends {}>(
|
||||||
callback: (args: any) => any,
|
callback: (args: any) => any,
|
||||||
payload: R
|
payload: R
|
||||||
): [
|
): [(args: T) => (args: T & { onProgress: (current: number, total: number) => void }) => any, EventChannel<any>] {
|
||||||
(args: T) => (args: T & { onProgress: (current: number, total: number) => void }) => any,
|
|
||||||
EventChannel<any>
|
|
||||||
] {
|
|
||||||
let emit;
|
let emit;
|
||||||
|
|
||||||
const chan = eventChannel(emitter => {
|
const chan = eventChannel(emitter => {
|
||||||
|
@ -22,9 +19,7 @@ export function createUploader<T extends {}, R extends {}>(
|
||||||
});
|
});
|
||||||
|
|
||||||
const onProgress = (current: number, total: number): void => {
|
const onProgress = (current: number, total: number): void => {
|
||||||
emit(
|
emit(current >= total ? END : { ...payload, progress: parseFloat((current / total).toFixed(1)) });
|
||||||
current >= total ? END : { ...payload, progress: parseFloat((current / total).toFixed(1)) }
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrappedCallback = args => callback({ ...args, onProgress });
|
const wrappedCallback = args => callback({ ...args, onProgress });
|
||||||
|
@ -45,11 +40,11 @@ export const uploadGetThumb = async file => {
|
||||||
export const fakeUploader = ({
|
export const fakeUploader = ({
|
||||||
file,
|
file,
|
||||||
onProgress,
|
onProgress,
|
||||||
mustSucceed,
|
mustSucceed
|
||||||
}: {
|
}: {
|
||||||
file: { url?: string; error?: string };
|
file: { url?: string; error?: string };
|
||||||
onProgress: (current: number, total: number) => void;
|
onProgress: (current: number, total: number) => void;
|
||||||
mustSucceed: boolean;
|
mustSucceed: boolean;
|
||||||
}): Promise<IResultWithStatus<IFile>> => {
|
}): Promise<IResultWithStatus<IFile>> => {
|
||||||
const { url, error } = file;
|
const { url, error } = file;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue