chore(plugin-cloud-storage): cleanup after import

This commit is contained in:
Elliot DeNolf
2023-10-24 16:20:01 -04:00
parent 7f80aa95a4
commit 11d237ece8
15 changed files with 752 additions and 8978 deletions

View File

@@ -1,10 +0,0 @@
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
max_line_length = null

View File

@@ -1,14 +1,37 @@
/** @type {import('prettier').Config} */
module.exports = {
root: true,
extends: ['./eslint-config'],
extends: ['@payloadcms'],
overrides: [
// Temporary overrides. Re-enable once platform is more mature
{
files: ['dev/**/*.ts'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
files: ['*.js', '*.cjs', '*.json', '*.md', '*.yml', '*.yaml'],
},
{
files: ['package.json', 'tsconfig.json'],
rules: {
'import/no-relative-packages': 'off',
'no-process-env': 'off',
'perfectionist/sort-array-includes': 'off',
'perfectionist/sort-astro-attributes': 'off',
'perfectionist/sort-classes': 'off',
'perfectionist/sort-enums': 'off',
'perfectionist/sort-exports': 'off',
'perfectionist/sort-imports': 'off',
'perfectionist/sort-interfaces': 'off',
'perfectionist/sort-jsx-props': 'off',
'perfectionist/sort-keys': 'off',
'perfectionist/sort-maps': 'off',
'perfectionist/sort-named-exports': 'off',
'perfectionist/sort-named-imports': 'off',
'perfectionist/sort-object-types': 'off',
'perfectionist/sort-objects': 'off',
'perfectionist/sort-svelte-attributes': 'off',
'perfectionist/sort-union-types': 'off',
'perfectionist/sort-vue-attributes': 'off',
},
},
],
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
root: true,
}

View File

@@ -1 +0,0 @@
eslint-config

View File

@@ -1,8 +0,0 @@
module.exports = {
printWidth: 100,
parser: "typescript",
semi: false,
singleQuote: true,
trailingComma: "all",
arrowParens: "avoid",
};

View File

@@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"sourceMaps": "inline",
"jsc": {
"target": "esnext",
"parser": {
"syntax": "typescript",
"tsx": true,
"dts": true
}
},
"module": {
"type": "commonjs"
}
}

View File

@@ -1,15 +0,0 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'airbnb-base',
require.resolve('./rules/style.js'),
require.resolve('./rules/import.js'),
require.resolve('./rules/typescript.js'),
require.resolve('./rules/prettier.js'),
],
env: {
es6: true,
browser: true,
node: true,
},
}

View File

@@ -1,38 +0,0 @@
module.exports = {
env: {
es6: true,
},
extends: ['plugin:import/errors', 'plugin:import/warnings', 'plugin:import/typescript'],
plugins: ['import'],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
},
rules: {
/**
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
*/
'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
'import/no-default-export': 'off',
'import/prefer-default-export': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
ts: 'never',
tsx: 'never',
js: 'never',
jsx: 'never',
},
],
'import/no-extraneous-dependencies': 'off',
/**
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
*/
'import/named': 'error',
'import/no-relative-packages': 'warn',
'import/no-import-module-exports': 'warn',
'import/no-cycle': 'warn',
},
}

View File

@@ -1,7 +0,0 @@
module.exports = {
plugins: ['prettier'],
extends: ['plugin:prettier/recommended'],
rules: {
'prettier/prettier': 'error',
},
}

View File

@@ -1,21 +0,0 @@
module.exports = {
rules: {
'prefer-named-exports': 'off',
'prefer-destructuring': 'off',
// 'prefer-destructuring': ['warn', { object: true, array: true }],
// ensure all object/arrays end with a comma
'comma-dangle': ['error', 'always-multiline'],
'class-methods-use-this': 'off',
// consistent new lines
'function-paren-newline': ['error', 'consistent'],
'eol-last': ['error', 'always'],
// allow restricted syntax like for...of loops
'no-restricted-syntax': 'off',
'no-await-in-loop': 'off',
'no-console': 'error',
// 'no-floating-promises': true,
// do not allow process.env access in files
'no-process-env': 'warn',
},
}

View File

@@ -1,628 +0,0 @@
module.exports = {
plugins: ['@typescript-eslint'],
overrides: [
{
files: ['**/**.ts', '**/**.d.ts'],
rules: {
'no-undef': 'off',
camelcase: 'off',
'@typescript-eslint/adjacent-overload-signatures': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md
*/
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md
*/
'@typescript-eslint/await-thenable': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-assertions.md
*/
'@typescript-eslint/consistent-type-assertions': [
'error',
{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow-as-parameter' },
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
*/
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-imports.md
*/
'@typescript-eslint/consistent-type-imports': 'warn',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
*/
'@typescript-eslint/explicit-function-return-type': [
'error',
{
// TODO: come back and check if we need those
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: false,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
*/
'@typescript-eslint/explicit-member-accessibility': [
'error',
{ accessibility: 'no-public' },
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md
*/
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/method-signature-style.md
*/
'@typescript-eslint/method-signature-style': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
*/
'@typescript-eslint/naming-convention': [
'off',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
// Enforce that type parameters (generics) are prefixed with T or U
{
selector: 'typeParameter',
format: ['PascalCase'],
prefix: ['T', 'U'],
},
// enforce boolean variables to start with proper prefix.
{
selector: 'variable',
types: ['boolean'],
format: ['PascalCase'],
prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
},
// Enforce that interface names do not begin with an I
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: false,
},
},
{
selector: [
'function',
'parameter',
'property',
'parameterProperty',
'method',
'accessor',
],
format: ['camelCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: ['class', 'interface', 'typeAlias', 'enum', 'typeParameter'],
format: ['PascalCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-base-to-string.md
*/
'@typescript-eslint/no-base-to-string': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md
*/
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dynamic-delete.md
*/
'@typescript-eslint/no-dynamic-delete': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.md
*/
'@typescript-eslint/no-empty-interface': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
*/
'@typescript-eslint/no-explicit-any': [
'warn',
{
ignoreRestArgs: true,
// enable later
fixToUnknown: false,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md
*/
'@typescript-eslint/no-extra-non-null-assertion': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extraneous-class.md
*/
'@typescript-eslint/no-extraneous-class': [
'error',
{
allowConstructorOnly: false,
allowEmpty: false,
allowStaticOnly: false,
allowWithDecorator: false,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md
*/
'@typescript-eslint/no-floating-promises': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-for-in-array.md
*/
'@typescript-eslint/no-for-in-array': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md
*/
'@typescript-eslint/no-implicit-any-catch': [
'error',
{
allowExplicitAny: false,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
*/
'@typescript-eslint/no-implied-eval': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-inferrable-types.md
*/
'@typescript-eslint/no-inferrable-types': [
'error',
{
ignoreParameters: false,
ignoreProperties: false,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-void-type.md
*/
'@typescript-eslint/no-invalid-void-type': [
'off',
{
allowInGenericTypeArguments: true,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-new.md
*/
'@typescript-eslint/no-misused-new': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-promises.md
*/
'@typescript-eslint/no-misused-promises': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md
*/
'@typescript-eslint/no-namespace': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md
*/
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
*/
'@typescript-eslint/no-non-null-assertion': 'warn',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md
*/
'@typescript-eslint/no-parameter-properties': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-require-imports.md
*/
'@typescript-eslint/no-require-imports': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-this-alias.md
*/
'@typescript-eslint/no-this-alias': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
*/
'@typescript-eslint/no-throw-literal': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-type-alias.md
*/
'@typescript-eslint/no-type-alias': [
'off',
{
allowAliases: 'always',
allowCallbacks: 'always',
allowConditionalTypes: 'always',
allowConstructors: 'never',
allowLiterals: 'in-unions-and-intersections',
allowMappedTypes: 'always',
allowTupleTypes: 'always',
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md
*/
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md
*/
'@typescript-eslint/no-unnecessary-condition': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md
*/
'@typescript-eslint/no-unnecessary-qualifier': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md
*/
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
*/
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md
*/
'@typescript-eslint/no-unsafe-assignment': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-call.md
*/
'@typescript-eslint/no-unsafe-call': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md
*/
'@typescript-eslint/no-unsafe-member-access': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-return.md
*/
'@typescript-eslint/no-unsafe-return': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-var-requires.md
*/
'@typescript-eslint/no-var-requires': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-as-const.md
*/
'@typescript-eslint/prefer-as-const': 'error',
/**
* We don't care about enums having implicit values.
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md
*/
'@typescript-eslint/prefer-enum-initializers': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-for-of.md
*/
'@typescript-eslint/prefer-for-of': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-includes.md
*/
'@typescript-eslint/prefer-includes': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md
*/
'@typescript-eslint/prefer-literal-enum-member': 'error',
/**
* using ES2015 syntax so this rule can be safetly turned off
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md
*/
'@typescript-eslint/prefer-namespace-keyword': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
*/
'@typescript-eslint/prefer-nullish-coalescing': 'off',
/**
* only set to warn because there are some cases this behavior doesnt work because
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-optional-chain.md
*/
'@typescript-eslint/prefer-optional-chain': 'warn',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly.md
*/
'@typescript-eslint/prefer-readonly': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md
*/
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md
*/
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md
*/
'@typescript-eslint/prefer-regexp-exec': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md
*/
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md
*/
'@typescript-eslint/prefer-ts-expect-error': 'warn',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/promise-function-async.md
*/
'@typescript-eslint/promise-function-async': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-array-sort-compare.md
*/
'@typescript-eslint/require-array-sort-compare': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-plus-operands.md
*/
'@typescript-eslint/restrict-plus-operands': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-template-expressions.md
*/
'@typescript-eslint/restrict-template-expressions': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md
*/
'@typescript-eslint/strict-boolean-expressions': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md
*/
'@typescript-eslint/switch-exhaustiveness-check': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.md
*/
'@typescript-eslint/triple-slash-reference': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/type-annotation-spacing.md
*/
'@typescript-eslint/type-annotation-spacing': [
'error',
{
before: false,
after: true,
overrides: {
arrow: {
before: true,
after: true,
},
},
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md
*/
'@typescript-eslint/typedef': [
'error',
{
arrayDestructuring: false,
arrowParameter: false,
memberVariableDeclaration: false,
objectDestructuring: false,
parameter: false,
propertyDeclaration: true,
variableDeclaration: false,
variableDeclarationIgnoreFunction: false,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unbound-method.md
*/
'@typescript-eslint/unbound-method': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md
*/
'@typescript-eslint/unified-signatures': 'off',
// @typescript-eslint Extension Rules
// ==================================================================================
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/brace-style.md
*/
'brace-style': 'off',
'@typescript-eslint/brace-style': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
*/
'comma-spacing': 'off',
'@typescript-eslint/comma-spacing': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/default-param-last.md
*/
'default-param-last': 'off',
'@typescript-eslint/default-param-last': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
*/
'dot-notation': 'error',
'@typescript-eslint/dot-notation': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
*/
'func-call-spacing': 'off',
'@typescript-eslint/func-call-spacing': 'error',
/**
* use prettier instead
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
*/
indent: 'off',
'@typescript-eslint/indent': 'off',
/**
* Allow a mix between the two
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/init-declarations.md
*/
'@typescript-eslint/init-declarations': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
*/
'keyword-spacing': 'off',
'@typescript-eslint/keyword-spacing': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
*/
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': [
'error',
'always',
{
// base eslint config
exceptAfterSingleLine: true,
// typescript specific
exceptAfterOverload: true,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
*/
'no-array-constructor': 'off',
'@typescript-eslint/no-array-constructor': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
*/
'no-dupe-class-members': 'off',
'@typescript-eslint/no-dupe-class-members': 'error',
/**
* Use prettier
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
*/
'no-extra-parens': 'off',
'@typescript-eslint/no-extra-parens': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
*/
'no-extra-semi': 'off',
'@typescript-eslint/no-extra-semi': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-this.md
*/
'no-invalid-this': 'off',
'@typescript-eslint/no-invalid-this': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loss-of-precision.md
*/
'no-loss-of-precision': 'off',
'@typescript-eslint/no-loss-of-precision': 'error',
/**
* https://eslint.org/docs/rules/no-magic-numbers
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
*/
'no-magic-numbers': 'off',
'@typescript-eslint/no-magic-numbers': [
'off',
{
// base eslint configs
ignoreArrayIndexes: true,
ignoreDefaultValues: true,
enforceConst: true,
// typescript specific configs
ignoreEnums: true,
ignoreNumericLiteralTypes: true,
ignoreReadonlyClassProperties: true,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
*/
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': [
'error',
{
// prevents variables from being created with global variable naming
builtinGlobals: true,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
*/
'no-shadow': 'off',
'@typescript-eslint/no-shadow': [
'error',
{
// No variables + types with same naming
ignoreTypeValueShadow: false,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
*/
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'error',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
*/
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
*/
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
*/
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
/**
* https://eslint.org/docs/rules/quotes
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
*/
quotes: 'off',
'@typescript-eslint/quotes': [
'error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
*/
'@typescript-eslint/require-await': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
*/
'@typescript-eslint/return-await': 'off',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
*/
semi: 'off',
'@typescript-eslint/semi': ['error', 'never'],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
*/
'space-before-function-paren': 'off',
'@typescript-eslint/space-before-function-paren': [
'error',
{
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
},
],
},
},
],
}

View File

@@ -6,16 +6,17 @@
"types": "dist/index.d.ts",
"license": "MIT",
"scripts": {
"build": "tsc",
"lint": "eslint src",
"lint:fix": "eslint --fix --ext .ts,.tsx src",
"clean": "rimraf dist && rimraf dev/yarn.lock",
"build": "pnpm build:swc && pnpm build:types",
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
"build:types": "tsc --emitDeclarationOnly --outDir dist",
"clean": "rimraf {dist,*.tsbuildinfo}",
"prepublishOnly": "yarn clean && yarn build"
},
"peerDependencies": {
"@aws-sdk/client-s3": "^3.142.0",
"@aws-sdk/lib-storage": "^3.267.0",
"@azure/storage-blob": "^12.11.0",
"@azure/abort-controller": "^1.0.0",
"@google-cloud/storage": "^6.4.1",
"payload": "^1.7.2 || ^2.0.0"
},
@@ -26,6 +27,9 @@
"@aws-sdk/lib-storage": {
"optional": true
},
"@azure/abort-controller": {
"optional": true
},
"@azure/storage-blob": {
"optional": true
},
@@ -44,21 +48,13 @@
"@azure/storage-blob": "^12.11.0",
"@google-cloud/storage": "^6.4.1",
"@types/express": "^4.17.9",
"@typescript-eslint/eslint-plugin": "5.12.1",
"@typescript-eslint/parser": "5.12.1",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"eslint": "^8.19.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-prettier": "^4.0.0",
"nodemon": "^2.0.6",
"payload": "^1.7.2",
"prettier": "^2.7.1",
"rimraf": "^4.1.2",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
"webpack": "^5.78.0"
},
"dependencies": {
"range-parser": "^1.2.1"

View File

@@ -16,10 +16,8 @@ const multipartThreshold = 1024 * 1024 * 50 // 50MB
export const getHandleUpload = ({ getStorageClient, prefix = '' }: Args): HandleUpload => {
return async ({ data, file }) => {
const fileKey = path.posix.join(data.prefix || prefix, file.filename)
const blockBlobClient = getStorageClient().getBlockBlobClient(
fileKey,
)
const blockBlobClient = getStorageClient().getBlockBlobClient(fileKey)
// when there are no temp files, or the upload is less than the threshold size, do not stream files
if (!file.tempFilePath && file.buffer.length > 0 && file.buffer.length < multipartThreshold) {

View File

@@ -1,23 +1,24 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"target": "es5",
"outDir": "./dist",
"allowJs": true,
"module": "commonjs",
"sourceMap": true,
"jsx": "react",
"esModuleInterop": true,
"declaration": true,
"declarationDir": "./dist",
"skipLibCheck": true,
"strict": true,
"composite": true, // Make sure typescript knows that this module depends on their references
"noEmit": false /* Do not emit outputs. */,
"emitDeclarationOnly": true,
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
"rootDir": "./src" /* Specify the root folder within your source files. */
},
"include": [
"src/**/*"
"exclude": [
"dist",
"build",
"tests",
"test",
"node_modules",
".eslintrc.js",
"src/**/*.spec.js",
"src/**/*.spec.jsx",
"src/**/*.spec.ts",
"src/**/*.spec.tsx"
],
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"],
"references": [{ "path": "../payload" }]
}

File diff suppressed because it is too large Load Diff

825
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff