@agilebot/eslint-config 0.3.14 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cli.js +15 -2
- package/dist/index.js +16 -13
- package/package.json +21 -22
package/dist/cli.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license @agilebot/eslint-config v0.
|
2
|
+
* @license @agilebot/eslint-config v0.4.1
|
3
3
|
*
|
4
4
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
5
|
*
|
@@ -56,12 +56,24 @@ var DEFAULT_EXTS = [...JS_EXTS, ...TS_EXTS, ...VUE_EXTS];
|
|
56
56
|
var IS_ESLINT = /^\.eslint.*/;
|
57
57
|
|
58
58
|
// src/cli/index.ts
|
59
|
+
function patch() {
|
60
|
+
process.env.ESLINT_USE_FLAT_CONFIG = "false";
|
61
|
+
const oldEmitWarning = process.emitWarning;
|
62
|
+
process.emitWarning = (warning, ...args) => {
|
63
|
+
if (args[0] === "ESLintRCWarning") {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
oldEmitWarning(warning, ...args);
|
67
|
+
};
|
68
|
+
}
|
59
69
|
function cli() {
|
70
|
+
patch();
|
60
71
|
const cwd = process.cwd();
|
61
72
|
const has = {
|
62
73
|
ext: false,
|
63
74
|
fix: false,
|
64
75
|
config: false,
|
76
|
+
strict: false,
|
65
77
|
checkIntl: false,
|
66
78
|
progress: false
|
67
79
|
};
|
@@ -71,6 +83,7 @@ function cli() {
|
|
71
83
|
has.ext = has.ext || arg === "--ext";
|
72
84
|
has.fix = has.fix || arg === "--fix";
|
73
85
|
has.config = has.config || arg === "-c" || arg === "--config";
|
86
|
+
has.strict = has.strict || arg === "--strict";
|
74
87
|
has.checkIntl = has.checkIntl || arg === "--check-intl";
|
75
88
|
has.progress = has.progress || arg === "--progress";
|
76
89
|
});
|
@@ -101,7 +114,7 @@ function cli() {
|
|
101
114
|
has.config = has.config || files.some((file) => {
|
102
115
|
return IS_ESLINT.test(file);
|
103
116
|
});
|
104
|
-
if (!has.config) {
|
117
|
+
if (has.strict && !has.config) {
|
105
118
|
throw new Error("No ESLint configuration file found");
|
106
119
|
}
|
107
120
|
require(bin);
|
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license @agilebot/eslint-config v0.
|
2
|
+
* @license @agilebot/eslint-config v0.4.1
|
3
3
|
*
|
4
4
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
5
|
*
|
@@ -85,7 +85,7 @@ function standard() {
|
|
85
85
|
// @ts-expect-error -- extracted rules from eslint-config-love
|
86
86
|
false ? {} : (
|
87
87
|
// @ts-expect-error -- extracted rules from eslint-config-love
|
88
|
-
JSON.parse('{"class-methods-use-this":["off"],"dot-notation":["off"],"init-declarations":["off"],"max-params":["off"],"no-array-constructor":["off"],"no-dupe-class-members":["off"],"no-empty-function":["off"],"no-implied-eval":["off"],"no-loop-func":["off"],"no-loss-of-precision":["off"],"no-redeclare":["off"],"no-unused-expressions":["off"],"no-unused-vars":["off"],"no-use-before-define":["off"],"no-useless-constructor":["off"],"prefer-promise-reject-errors":["off"],"@typescript-eslint/adjacent-overload-signatures":["error"],"@typescript-eslint/array-type":["error",{"default":"array-simple"}],"@typescript-eslint/await-thenable":["error"],"@typescript-eslint/ban-ts-comment":["error",{"ts-expect-error":"allow-with-description","ts-ignore":true,"ts-nocheck":true,"ts-check":false,"minimumDescriptionLength":3}],"@typescript-eslint/ban-tslint-comment":["error"],"@typescript-eslint/ban-types":["error",{"extendDefaults":false,"types":{"String":{"message":"Use string instead","fixWith":"string"},"Boolean":{"message":"Use boolean instead","fixWith":"boolean"},"Number":{"message":"Use number instead","fixWith":"number"},"Symbol":{"message":"Use symbol instead","fixWith":"symbol"},"BigInt":{"message":"Use bigint instead","fixWith":"bigint"},"Function":{"message":"The `Function` type accepts any function-like value.\\nIt provides no type safety when calling the function, which can be a common source of bugs.\\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.\\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape."},"Object":{"message":"The `Object` type actually means \\"any non-nullish value\\", so it is marginally better than `unknown`.\\n- If you want a type meaning \\"any object\\", you probably want `Record<string, unknown>` instead.\\n- If you want a type meaning \\"any value\\", you probably want `unknown` instead."},"{}":{"message":"`{}` actually means \\"any non-nullish value\\".\\n- If you want a type meaning \\"any object\\", you probably want `Record<string, unknown>` instead.\\n- If you want a type meaning \\"any value\\", you probably want `unknown` instead."}}}],"@typescript-eslint/class-methods-use-this":["error",{"exceptMethods":[],"enforceForClassFields":true,"ignoreOverrideMethods":false,"ignoreClassesThatImplementAnInterface":false}],"@typescript-eslint/class-literal-property-style":["error","fields"],"@typescript-eslint/consistent-generic-constructors":["error","constructor"],"@typescript-eslint/consistent-indexed-object-style":["error","record"],"@typescript-eslint/consistent-type-assertions":["error",{"assertionStyle":"as","objectLiteralTypeAssertions":"never"}],"@typescript-eslint/consistent-type-definitions":["error","interface"],"@typescript-eslint/consistent-type-exports":["error",{"fixMixedExportsWithInlineTypeSpecifier":true}],"@typescript-eslint/consistent-type-imports":["error",{"prefer":"type-imports","disallowTypeAnnotations":true,"fixStyle":"inline-type-imports"}],"@typescript-eslint/dot-notation":["error",{"allowIndexSignaturePropertyAccess":false,"allowKeywords":true,"allowPattern":"","allowPrivateClassPropertyAccess":false,"allowProtectedClassPropertyAccess":false}],"@typescript-eslint/explicit-function-return-type":["error",{"allowExpressions":true,"allowHigherOrderFunctions":true,"allowTypedFunctionExpressions":true,"allowDirectConstAssertionInArrowFunctions":true}],"@typescript-eslint/init-declarations":["error","always"],"@typescript-eslint/max-params":["error",{"max":4}],"@typescript-eslint/method-signature-style":["error"],"@typescript-eslint/naming-convention":["error",{"selector":"variableLike","leadingUnderscore":"allow","trailingUnderscore":"allow","format":["camelCase","PascalCase","UPPER_CASE"]}],"@typescript-eslint/no-array-constructor":["error"],"@typescript-eslint/no-array-delete":["error"],"@typescript-eslint/no-base-to-string":["error"],"@typescript-eslint/no-confusing-non-null-assertion":["error"],"@typescript-eslint/no-confusing-void-expression":["error",{"ignoreArrowShorthand":false,"ignoreVoidOperator":false}],"@typescript-eslint/no-dupe-class-members":["error"],"@typescript-eslint/no-duplicate-enum-values":["error"],"@typescript-eslint/no-duplicate-type-constituents":["error",{"ignoreIntersections":false,"ignoreUnions":false}],"@typescript-eslint/no-dynamic-delete":["error"],"@typescript-eslint/no-empty-function":["error",{"allow":[]}],"@typescript-eslint/no-explicit-any":["error",{"fixToUnknown":false,"ignoreRestArgs":false}],"@typescript-eslint/no-extra-non-null-assertion":["error"],"@typescript-eslint/no-extraneous-class":["error",{"allowWithDecorator":true}],"@typescript-eslint/no-empty-object-type":["error",{"allowInterfaces":"with-single-extends","allowObjectTypes":"never"}],"@typescript-eslint/no-floating-promises":["error"],"@typescript-eslint/no-for-in-array":["error"],"@typescript-eslint/no-implied-eval":["error"],"@typescript-eslint/no-import-type-side-effects":["error"],"@typescript-eslint/no-inferrable-types":["error",{"ignoreParameters":false,"ignoreProperties":false}],"@typescript-eslint/no-invalid-void-type":["error"],"@typescript-eslint/no-loop-func":["error"],"@typescript-eslint/no-loss-of-precision":["error"],"@typescript-eslint/no-misused-new":["error"],"@typescript-eslint/no-misused-promises":["error"],"@typescript-eslint/no-namespace":["error"],"@typescript-eslint/no-non-null-asserted-optional-chain":["error"],"@typescript-eslint/no-non-null-assertion":["error"],"@typescript-eslint/no-redeclare":["error",{"builtinGlobals":false}],"@typescript-eslint/no-this-alias":["error",{"allowDestructuring":true}],"@typescript-eslint/no-unnecessary-boolean-literal-compare":["error"],"@typescript-eslint/no-unnecessary-type-assertion":["error"],"@typescript-eslint/no-unnecessary-type-constraint":["error"],"@typescript-eslint/no-unsafe-argument":["error"],"@typescript-eslint/no-unused-expressions":["error",{"allowShortCircuit":true,"allowTernary":true,"allowTaggedTemplates":true,"enforceForJSX":false}],"@typescript-eslint/no-unused-vars":["error",{"args":"none","caughtErrors":"none","ignoreRestSiblings":true,"vars":"all"}],"@typescript-eslint/no-use-before-define":["error",{"functions":false,"classes":false,"enums":false,"variables":false,"typedefs":false}],"@typescript-eslint/no-useless-constructor":["error"],"@typescript-eslint/no-var-requires":["error"],"@typescript-eslint/non-nullable-type-assertion-style":["error"],"@typescript-eslint/only-throw-error":["error",{"allowThrowingAny":false,"allowThrowingUnknown":false}],"@typescript-eslint/prefer-function-type":["error"],"@typescript-eslint/prefer-includes":["error"],"@typescript-eslint/prefer-nullish-coalescing":["error",{"ignoreConditionalTests":false,"ignoreMixedLogicalExpressions":false}],"@typescript-eslint/prefer-optional-chain":["error"],"@typescript-eslint/prefer-promise-reject-errors":["error"],"@typescript-eslint/prefer-readonly":["error"],"@typescript-eslint/prefer-reduce-type-parameter":["error"],"@typescript-eslint/prefer-return-this-type":["error"],"@typescript-eslint/promise-function-async":["error"],"@typescript-eslint/require-array-sort-compare":["error",{"ignoreStringArrays":true}],"@typescript-eslint/restrict-plus-operands":["error",{"skipCompoundAssignments":false}],"@typescript-eslint/restrict-template-expressions":["error",{"allowNumber":true}],"@typescript-eslint/return-await":["error","always"],"@typescript-eslint/strict-boolean-expressions":["error",{"allowString":false,"allowNumber":false,"allowNullableObject":false,"allowNullableBoolean":false,"allowNullableString":false,"allowNullableNumber":false,"allowAny":false}],"@typescript-eslint/triple-slash-reference":["error",{"lib":"never","path":"never","types":"never"}],"@typescript-eslint/unbound-method":["error",{"ignoreStatic":false}],"accessor-pairs":["error",{"setWithoutGet":true,"getWithoutSet":false,"enforceForClassMembers":true}],"array-callback-return":["error",{"allowImplicit":false,"allowVoid":false,"checkForEach":false}],"constructor-super":["error"],"curly":["error","multi-line"],"default-case-last":["error"],"eqeqeq":["error","always",{"null":"ignore"}],"new-cap":["error",{"newIsCap":true,"capIsNew":false,"properties":true}],"no-async-promise-executor":["error"],"no-caller":["error"],"no-case-declarations":["error"],"no-class-assign":["error"],"no-compare-neg-zero":["error"],"no-cond-assign":["error"],"no-const-assign":["error"],"no-constant-condition":["error",{"checkLoops":false}],"no-control-regex":["error"],"no-debugger":["error"],"no-delete-var":["error"],"no-dupe-args":["error"],"no-dupe-keys":["error"],"no-duplicate-case":["error"],"no-useless-backreference":["error"],"no-empty":["error",{"allowEmptyCatch":true}],"no-empty-character-class":["error"],"no-empty-pattern":["error"],"no-eval":["error"],"no-ex-assign":["error"],"no-extend-native":["error"],"no-extra-bind":["error"],"no-extra-boolean-cast":["error"],"no-fallthrough":["error"],"no-func-assign":["error"],"no-global-assign":["error"],"no-import-assign":["error"],"no-invalid-regexp":["error"],"no-irregular-whitespace":["error"],"no-iterator":["error"],"no-labels":["error",{"allowLoop":false,"allowSwitch":false}],"no-lone-blocks":["error"],"no-misleading-character-class":["error"],"no-prototype-builtins":["error"],"no-useless-catch":["error"],"no-multi-str":["error"],"no-new":["error"],"no-new-func":["error"],"no-new-symbol":["error"],"no-new-wrappers":["error"],"no-obj-calls":["error"],"no-object-constructor":["error"],"no-octal":["error"],"no-octal-escape":["error"],"no-proto":["error"],"no-regex-spaces":["error"],"no-return-assign":["error","except-parens"],"no-self-assign":["error",{"props":true}],"no-self-compare":["error"],"no-sequences":["error"],"no-shadow-restricted-names":["error"],"no-sparse-arrays":["error"],"no-template-curly-in-string":["error"],"no-this-before-super":["error"],"no-throw-literal":["off"],"no-undef-init":["error"],"no-unexpected-multiline":["error"],"no-unmodified-loop-condition":["error"],"no-unneeded-ternary":["error",{"defaultAssignment":false}],"no-unreachable":["error"],"no-unreachable-loop":["error"],"no-unsafe-finally":["error"],"no-unsafe-negation":["error"],"no-useless-call":["error"],"no-useless-computed-key":["error"],"no-useless-escape":["error"],"no-useless-rename":["error"],"no-useless-return":["error"],"no-var":["error"],"no-void":["error",{"allowAsStatement":true}],"no-with":["error"],"object-shorthand":["warn","properties"],"one-var":["error",{"initialized":"never"}],"prefer-const":["error",{"destructuring":"all","ignoreReadBeforeAssign":false}],"prefer-regex-literals":["error",{"disallowRedundantWrapping":true}],"symbol-description":["error"],"unicode-bom":["error","never"],"use-isnan":["error",{"enforceForSwitchCase":true,"enforceForIndexOf":true}],"valid-typeof":["error",{"requireStringLiterals":true}],"yoda":["error","never"],"import/export":["error"],"import/first":["error"],"import/no-absolute-path":["error",{"esmodule":true,"commonjs":true,"amd":false}],"import/no-duplicates":["error"],"import/no-named-default":["error"],"import/no-webpack-loader-syntax":["error"],"n/handle-callback-err":["error","^(err|error)$"],"n/no-callback-literal":["error"],"n/no-deprecated-api":["error"],"n/no-exports-assign":["error"],"n/no-new-require":["error"],"n/no-path-concat":["error"],"n/process-exit-as-throw":["error"],"promise/param-names":["error"]}')
|
88
|
+
JSON.parse('{"class-methods-use-this":["off"],"dot-notation":["off"],"init-declarations":["off"],"max-params":["off"],"no-array-constructor":["off"],"no-dupe-class-members":["off"],"no-empty-function":["off"],"no-implied-eval":["off"],"no-loop-func":["off"],"no-redeclare":["off"],"no-unused-expressions":["off"],"no-unused-vars":["off"],"no-use-before-define":["off"],"no-useless-constructor":["off"],"prefer-promise-reject-errors":["off"],"@typescript-eslint/adjacent-overload-signatures":["error"],"@typescript-eslint/array-type":["error",{"default":"array-simple"}],"@typescript-eslint/await-thenable":["error"],"@typescript-eslint/ban-ts-comment":["error",{"ts-expect-error":"allow-with-description","ts-ignore":true,"ts-nocheck":true,"ts-check":false,"minimumDescriptionLength":3}],"@typescript-eslint/ban-tslint-comment":["error"],"@typescript-eslint/class-methods-use-this":["error",{"exceptMethods":[],"enforceForClassFields":true,"ignoreOverrideMethods":false,"ignoreClassesThatImplementAnInterface":false}],"@typescript-eslint/class-literal-property-style":["error","fields"],"@typescript-eslint/consistent-generic-constructors":["error","constructor"],"@typescript-eslint/consistent-indexed-object-style":["error","record"],"@typescript-eslint/consistent-type-assertions":["error",{"assertionStyle":"as","objectLiteralTypeAssertions":"never"}],"@typescript-eslint/consistent-type-definitions":["error","interface"],"@typescript-eslint/consistent-type-exports":["error",{"fixMixedExportsWithInlineTypeSpecifier":true}],"@typescript-eslint/consistent-type-imports":["error",{"prefer":"type-imports","disallowTypeAnnotations":true,"fixStyle":"inline-type-imports"}],"@typescript-eslint/dot-notation":["error",{"allowIndexSignaturePropertyAccess":false,"allowKeywords":true,"allowPattern":"","allowPrivateClassPropertyAccess":false,"allowProtectedClassPropertyAccess":false}],"@typescript-eslint/explicit-function-return-type":["error",{"allowExpressions":true,"allowHigherOrderFunctions":true,"allowTypedFunctionExpressions":true,"allowDirectConstAssertionInArrowFunctions":true}],"@typescript-eslint/init-declarations":["error","always"],"@typescript-eslint/max-params":["error",{"max":4}],"@typescript-eslint/method-signature-style":["error"],"@typescript-eslint/naming-convention":["error",{"selector":"variableLike","leadingUnderscore":"allow","trailingUnderscore":"allow","format":["camelCase","PascalCase","UPPER_CASE"]}],"@typescript-eslint/no-array-constructor":["error"],"@typescript-eslint/no-array-delete":["error"],"@typescript-eslint/no-base-to-string":["error"],"@typescript-eslint/no-confusing-non-null-assertion":["error"],"@typescript-eslint/no-confusing-void-expression":["error",{"ignoreArrowShorthand":false,"ignoreVoidOperator":false}],"@typescript-eslint/no-dupe-class-members":["error"],"@typescript-eslint/no-duplicate-enum-values":["error"],"@typescript-eslint/no-duplicate-type-constituents":["error",{"ignoreIntersections":false,"ignoreUnions":false}],"@typescript-eslint/no-dynamic-delete":["error"],"@typescript-eslint/no-empty-function":["error",{"allow":[]}],"@typescript-eslint/no-explicit-any":["error",{"fixToUnknown":false,"ignoreRestArgs":false}],"@typescript-eslint/no-extra-non-null-assertion":["error"],"@typescript-eslint/no-extraneous-class":["error",{"allowWithDecorator":true}],"@typescript-eslint/no-empty-object-type":["error",{"allowInterfaces":"with-single-extends","allowObjectTypes":"never"}],"@typescript-eslint/no-floating-promises":["error"],"@typescript-eslint/no-for-in-array":["error"],"@typescript-eslint/no-implied-eval":["error"],"@typescript-eslint/no-import-type-side-effects":["error"],"@typescript-eslint/no-inferrable-types":["error",{"ignoreParameters":false,"ignoreProperties":false}],"@typescript-eslint/no-invalid-void-type":["error"],"@typescript-eslint/no-loop-func":["error"],"@typescript-eslint/no-misused-new":["error"],"@typescript-eslint/no-misused-promises":["error"],"@typescript-eslint/no-namespace":["error"],"@typescript-eslint/no-non-null-asserted-optional-chain":["error"],"@typescript-eslint/no-non-null-assertion":["error"],"@typescript-eslint/no-redeclare":["error",{"builtinGlobals":false}],"@typescript-eslint/no-require-imports":["error",{"allow":[],"allowAsImport":false}],"@typescript-eslint/no-this-alias":["error",{"allowDestructuring":true}],"@typescript-eslint/no-unnecessary-boolean-literal-compare":["error"],"@typescript-eslint/no-unnecessary-type-assertion":["error"],"@typescript-eslint/no-unnecessary-type-constraint":["error"],"@typescript-eslint/no-unsafe-argument":["error"],"@typescript-eslint/no-unsafe-function-type":["error"],"@typescript-eslint/no-unused-expressions":["error",{"allowShortCircuit":true,"allowTernary":true,"allowTaggedTemplates":true,"enforceForJSX":false}],"@typescript-eslint/no-unused-vars":["error",{"args":"none","caughtErrors":"none","ignoreRestSiblings":true,"vars":"all"}],"@typescript-eslint/no-use-before-define":["error",{"functions":false,"classes":false,"enums":false,"variables":false,"typedefs":false}],"@typescript-eslint/no-useless-constructor":["error"],"@typescript-eslint/no-wrapper-object-types":["error"],"@typescript-eslint/non-nullable-type-assertion-style":["error"],"@typescript-eslint/only-throw-error":["error",{"allowThrowingAny":false,"allowThrowingUnknown":false}],"@typescript-eslint/prefer-function-type":["error"],"@typescript-eslint/prefer-includes":["error"],"@typescript-eslint/prefer-nullish-coalescing":["error",{"ignoreConditionalTests":false,"ignoreMixedLogicalExpressions":false}],"@typescript-eslint/prefer-optional-chain":["error"],"@typescript-eslint/prefer-promise-reject-errors":["error"],"@typescript-eslint/prefer-readonly":["error"],"@typescript-eslint/prefer-reduce-type-parameter":["error"],"@typescript-eslint/prefer-return-this-type":["error"],"@typescript-eslint/promise-function-async":["error"],"@typescript-eslint/require-array-sort-compare":["error",{"ignoreStringArrays":true}],"@typescript-eslint/restrict-plus-operands":["error",{"skipCompoundAssignments":false}],"@typescript-eslint/restrict-template-expressions":["error",{"allowNumber":true}],"@typescript-eslint/return-await":["error","always"],"@typescript-eslint/strict-boolean-expressions":["error",{"allowString":false,"allowNumber":false,"allowNullableObject":false,"allowNullableBoolean":false,"allowNullableString":false,"allowNullableNumber":false,"allowAny":false}],"@typescript-eslint/triple-slash-reference":["error",{"lib":"never","path":"never","types":"never"}],"@typescript-eslint/unbound-method":["error",{"ignoreStatic":false}],"accessor-pairs":["error",{"setWithoutGet":true,"getWithoutSet":false,"enforceForClassMembers":true}],"array-callback-return":["error",{"allowImplicit":false,"allowVoid":false,"checkForEach":false}],"constructor-super":["error"],"curly":["error","multi-line"],"default-case-last":["error"],"eqeqeq":["error","always",{"null":"ignore"}],"new-cap":["error",{"newIsCap":true,"capIsNew":false,"properties":true}],"no-async-promise-executor":["error"],"no-caller":["error"],"no-case-declarations":["error"],"no-class-assign":["error"],"no-compare-neg-zero":["error"],"no-cond-assign":["error"],"no-const-assign":["error"],"no-constant-condition":["error",{"checkLoops":false}],"no-control-regex":["error"],"no-debugger":["error"],"no-delete-var":["error"],"no-dupe-args":["error"],"no-dupe-keys":["error"],"no-duplicate-case":["error"],"no-useless-backreference":["error"],"no-empty":["error",{"allowEmptyCatch":true}],"no-empty-character-class":["error"],"no-empty-pattern":["error"],"no-eval":["error"],"no-ex-assign":["error"],"no-extend-native":["error"],"no-extra-bind":["error"],"no-extra-boolean-cast":["error"],"no-fallthrough":["error"],"no-func-assign":["error"],"no-global-assign":["error"],"no-import-assign":["error"],"no-invalid-regexp":["error"],"no-irregular-whitespace":["error"],"no-iterator":["error"],"no-labels":["error",{"allowLoop":false,"allowSwitch":false}],"no-lone-blocks":["error"],"no-loss-of-precision":["error"],"no-misleading-character-class":["error"],"no-prototype-builtins":["error"],"no-useless-catch":["error"],"no-multi-str":["error"],"no-new":["error"],"no-new-func":["error"],"no-new-symbol":["error"],"no-new-wrappers":["error"],"no-obj-calls":["error"],"no-object-constructor":["error"],"no-octal":["error"],"no-octal-escape":["error"],"no-proto":["error"],"no-regex-spaces":["error"],"no-return-assign":["error","except-parens"],"no-self-assign":["error",{"props":true}],"no-self-compare":["error"],"no-sequences":["error"],"no-shadow-restricted-names":["error"],"no-sparse-arrays":["error"],"no-template-curly-in-string":["error"],"no-this-before-super":["error"],"no-throw-literal":["off"],"no-undef-init":["error"],"no-unexpected-multiline":["error"],"no-unmodified-loop-condition":["error"],"no-unneeded-ternary":["error",{"defaultAssignment":false}],"no-unreachable":["error"],"no-unreachable-loop":["error"],"no-unsafe-finally":["error"],"no-unsafe-negation":["error"],"no-useless-call":["error"],"no-useless-computed-key":["error"],"no-useless-escape":["error"],"no-useless-rename":["error"],"no-useless-return":["error"],"no-var":["error"],"no-void":["error",{"allowAsStatement":true}],"no-with":["error"],"object-shorthand":["warn","properties"],"one-var":["error",{"initialized":"never"}],"prefer-const":["error",{"destructuring":"all","ignoreReadBeforeAssign":false}],"prefer-regex-literals":["error",{"disallowRedundantWrapping":true}],"symbol-description":["error"],"unicode-bom":["error","never"],"use-isnan":["error",{"enforceForSwitchCase":true,"enforceForIndexOf":true}],"valid-typeof":["error",{"requireStringLiterals":true}],"yoda":["error","never"],"import/export":["error"],"import/first":["error"],"import/no-absolute-path":["error",{"esmodule":true,"commonjs":true,"amd":false}],"import/no-duplicates":["error"],"import/no-named-default":["error"],"import/no-webpack-loader-syntax":["error"],"n/handle-callback-err":["error","^(err|error)$"],"n/no-callback-literal":["error"],"n/no-deprecated-api":["error"],"n/no-exports-assign":["error"],"n/no-new-require":["error"],"n/no-path-concat":["error"],"n/process-exit-as-throw":["error"],"promise/param-names":["error"]}')
|
89
89
|
)
|
90
90
|
);
|
91
91
|
Object.entries(originalStdRules).forEach(([key, value]) => {
|
@@ -111,6 +111,7 @@ function standard() {
|
|
111
111
|
"n/no-sync": "error",
|
112
112
|
// 尽量使用fs.promises而不是fs
|
113
113
|
"n/prefer-promises/fs": "error",
|
114
|
+
"n/prefer-promises/dns": "error",
|
114
115
|
// 路径拼接使用path.join,而不是直接使用加号
|
115
116
|
"n/no-path-concat": "error",
|
116
117
|
"promise/no-return-wrap": "error",
|
@@ -271,7 +272,7 @@ function tsOnly() {
|
|
271
272
|
function jsOnly() {
|
272
273
|
return {
|
273
274
|
rules: {
|
274
|
-
"@typescript-eslint/no-
|
275
|
+
"@typescript-eslint/no-require-imports": "off"
|
275
276
|
}
|
276
277
|
};
|
277
278
|
}
|
@@ -517,6 +518,10 @@ function react(opts) {
|
|
517
518
|
// recommended rules from @eslint-react/naming-convention
|
518
519
|
"@eslint-react/naming-convention/component-name": "error",
|
519
520
|
"@eslint-react/naming-convention/use-state": "error",
|
521
|
+
// recommended rules from @eslint-react/web-api
|
522
|
+
"@eslint-react/web-api/no-leaked-interval": "warn",
|
523
|
+
"@eslint-react/web-api/no-leaked-timeout": "warn",
|
524
|
+
"@eslint-react/web-api/no-leaked-event-listener": "warn",
|
520
525
|
// 以下是自定义规则
|
521
526
|
"react/jsx-handler-names": [
|
522
527
|
"error",
|
@@ -526,8 +531,6 @@ function react(opts) {
|
|
526
531
|
checkLocalVariables: true
|
527
532
|
}
|
528
533
|
],
|
529
|
-
// 已经有ts校验,此规则没有必要,会与带静态属性的Functional Component冲突
|
530
|
-
"react/prop-types": "off",
|
531
534
|
// <App prop={'Hello'} />没必要,使用<App prop="Hello" />
|
532
535
|
"react/jsx-curly-brace-presence": [
|
533
536
|
"error",
|
@@ -599,18 +602,18 @@ function lodash() {
|
|
599
602
|
// src/configs/comments.ts
|
600
603
|
function comments() {
|
601
604
|
return {
|
602
|
-
plugins: ["eslint-comments"],
|
605
|
+
plugins: ["@eslint-community/eslint-comments"],
|
603
606
|
rules: {
|
604
607
|
// 禁止未使用的eslint-disable注释
|
605
|
-
"eslint-comments/no-unused-disable": "error",
|
608
|
+
"@eslint-community/eslint-comments/no-unused-disable": "error",
|
606
609
|
// 禁止无限制的eslint-disable注释
|
607
|
-
"eslint-comments/no-unlimited-disable": "error",
|
610
|
+
"@eslint-community/eslint-comments/no-unlimited-disable": "error",
|
608
611
|
// 禁止重复的eslint-disable注释
|
609
|
-
"eslint-comments/no-duplicate-disable": "error",
|
612
|
+
"@eslint-community/eslint-comments/no-duplicate-disable": "error",
|
610
613
|
// 禁止聚合的eslint-enable注释
|
611
|
-
"eslint-comments/no-aggregating-enable": "error",
|
614
|
+
"@eslint-community/eslint-comments/no-aggregating-enable": "error",
|
612
615
|
// 须说明原因eslint-disable
|
613
|
-
"eslint-comments/require-description": [
|
616
|
+
"@eslint-community/eslint-comments/require-description": [
|
614
617
|
"error",
|
615
618
|
{
|
616
619
|
ignore: ["eslint-env", "exported", "global", "globals"]
|
@@ -623,10 +626,10 @@ function comments() {
|
|
623
626
|
// src/configs/deprecation.ts
|
624
627
|
function deprecation() {
|
625
628
|
return {
|
626
|
-
plugins: ["
|
629
|
+
plugins: ["@agilebot"],
|
627
630
|
rules: {
|
628
631
|
// 禁止使用带有deprecation标记的方法或属性
|
629
|
-
"
|
632
|
+
"@agilebot/deprecation": "error"
|
630
633
|
}
|
631
634
|
};
|
632
635
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@agilebot/eslint-config",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.4.1",
|
4
4
|
"description": "Agilebot's ESLint config",
|
5
5
|
"bin": {
|
6
6
|
"eslint-agilebot": "bin/eslint-agilebot"
|
@@ -18,41 +18,40 @@
|
|
18
18
|
},
|
19
19
|
"homepage": "https://github.com/sh-agilebot/frontend-toolkit/tree/master/packages/eslint-config#readme",
|
20
20
|
"dependencies": {
|
21
|
-
"@cspell/eslint-plugin": "^8.
|
22
|
-
"@eslint-
|
23
|
-
"@
|
24
|
-
"@
|
25
|
-
"@typescript-eslint/
|
21
|
+
"@cspell/eslint-plugin": "^8.14.2",
|
22
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
23
|
+
"@eslint-react/eslint-plugin": "^1.12.1",
|
24
|
+
"@stylistic/eslint-plugin": "^2.6.4",
|
25
|
+
"@typescript-eslint/eslint-plugin": "~8.2.0",
|
26
|
+
"@typescript-eslint/parser": "~8.2.0",
|
26
27
|
"eslint-config-godaddy": "^6.0.0",
|
27
28
|
"eslint-config-prettier": "^9.1.0",
|
28
29
|
"eslint-import-resolver-oxc": "^0.2.0",
|
29
30
|
"eslint-import-resolver-typescript": "^3.6.1",
|
30
|
-
"eslint-plugin-
|
31
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
32
|
-
"eslint-plugin-file-progress": "^1.4.0",
|
31
|
+
"eslint-plugin-file-progress": "^1.5.0",
|
33
32
|
"eslint-plugin-import-x": "^3.1.0",
|
34
|
-
"eslint-plugin-jsdoc": "^
|
33
|
+
"eslint-plugin-jsdoc": "^50.2.2",
|
35
34
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
36
|
-
"eslint-plugin-n": "^17.10.
|
35
|
+
"eslint-plugin-n": "^17.10.2",
|
37
36
|
"eslint-plugin-no-relative-import-paths": "^1.5.5",
|
38
|
-
"eslint-plugin-prefer-arrow-functions": "^3.
|
37
|
+
"eslint-plugin-prefer-arrow-functions": "^3.4.1",
|
39
38
|
"eslint-plugin-prettier": "^5.2.1",
|
40
|
-
"eslint-plugin-promise": "^7.
|
39
|
+
"eslint-plugin-promise": "^7.1.0",
|
41
40
|
"eslint-plugin-react": "^7.35.0",
|
42
41
|
"eslint-plugin-react-hooks": "^4.6.2",
|
43
|
-
"eslint-plugin-unicorn": "^
|
44
|
-
"eslint-plugin-unused-imports": "^
|
45
|
-
"eslint-plugin-vue": "^9.
|
42
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
43
|
+
"eslint-plugin-unused-imports": "^4.1.3",
|
44
|
+
"eslint-plugin-vue": "^9.27.0",
|
46
45
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
|
47
|
-
"vue-eslint-parser": "^9.4.
|
48
|
-
"@agilebot/eslint-utils": "0.
|
46
|
+
"vue-eslint-parser": "^9.4.3",
|
47
|
+
"@agilebot/eslint-utils": "0.4.1"
|
49
48
|
},
|
50
49
|
"devDependencies": {
|
51
|
-
"eslint-config-love": "^
|
50
|
+
"eslint-config-love": "^63.0.0"
|
52
51
|
},
|
53
52
|
"peerDependencies": {
|
54
|
-
"eslint": "^7.0.0 || ^8.0.0",
|
55
|
-
"@agilebot/eslint-plugin": "0.
|
53
|
+
"eslint": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
54
|
+
"@agilebot/eslint-plugin": "0.4.1"
|
56
55
|
},
|
57
56
|
"files": [
|
58
57
|
"bin",
|
@@ -60,6 +59,6 @@
|
|
60
59
|
],
|
61
60
|
"scripts": {
|
62
61
|
"build": "tsup",
|
63
|
-
"lint": "eslint src
|
62
|
+
"lint": "eslint-agilebot src"
|
64
63
|
}
|
65
64
|
}
|