@typescript-eslint/eslint-plugin
Advanced tools
Comparing version 6.14.0 to 6.15.0
@@ -138,2 +138,3 @@ "use strict"; | ||
'@typescript-eslint/no-useless-empty-export': 'error', | ||
'@typescript-eslint/no-useless-template-literals': 'error', | ||
'@typescript-eslint/no-var-requires': 'error', | ||
@@ -140,0 +141,0 @@ '@typescript-eslint/non-nullable-type-assertion-style': 'error', |
@@ -38,2 +38,3 @@ "use strict"; | ||
'@typescript-eslint/no-unsafe-unary-minus': 'off', | ||
'@typescript-eslint/no-useless-template-literals': 'off', | ||
'@typescript-eslint/non-nullable-type-assertion-style': 'off', | ||
@@ -40,0 +41,0 @@ '@typescript-eslint/prefer-destructuring': 'off', |
@@ -59,2 +59,3 @@ "use strict"; | ||
'@typescript-eslint/no-useless-constructor': 'error', | ||
'@typescript-eslint/no-useless-template-literals': 'error', | ||
'@typescript-eslint/no-var-requires': 'error', | ||
@@ -61,0 +62,0 @@ '@typescript-eslint/prefer-as-const': 'error', |
@@ -136,3 +136,3 @@ "use strict"; | ||
// We have both type and value violations. | ||
const allExportNames = report.typeBasedSpecifiers.map(specifier => `${specifier.local.name}`); | ||
const allExportNames = report.typeBasedSpecifiers.map(specifier => specifier.local.name); | ||
if (allExportNames.length === 1) { | ||
@@ -139,0 +139,0 @@ const exportNames = allExportNames[0]; |
@@ -101,2 +101,3 @@ "use strict"; | ||
const no_useless_empty_export_1 = __importDefault(require("./no-useless-empty-export")); | ||
const no_useless_template_literals_1 = __importDefault(require("./no-useless-template-literals")); | ||
const no_var_requires_1 = __importDefault(require("./no-var-requires")); | ||
@@ -239,2 +240,3 @@ const non_nullable_type_assertion_style_1 = __importDefault(require("./non-nullable-type-assertion-style")); | ||
'no-useless-empty-export': no_useless_empty_export_1.default, | ||
'no-useless-template-literals': no_useless_template_literals_1.default, | ||
'no-var-requires': no_var_requires_1.default, | ||
@@ -241,0 +243,0 @@ 'non-nullable-type-assertion-style': non_nullable_type_assertion_style_1.default, |
@@ -14,3 +14,3 @@ "use strict"; | ||
docs: { | ||
description: 'Require `Array#sort` calls to always provide a `compareFunction`', | ||
description: 'Require `Array#sort` and `Array#toSorted` calls to always provide a `compareFunction`', | ||
requiresTypeChecking: true, | ||
@@ -49,12 +49,14 @@ }, | ||
} | ||
function checkSortArgument(callee) { | ||
const calleeObjType = (0, util_1.getConstrainedTypeAtLocation)(services, callee.object); | ||
if (options.ignoreStringArrays && isStringArrayNode(callee.object)) { | ||
return; | ||
} | ||
if ((0, util_1.isTypeArrayTypeOrUnionOfArrayTypes)(calleeObjType, checker)) { | ||
context.report({ node: callee.parent, messageId: 'requireCompare' }); | ||
} | ||
} | ||
return { | ||
"CallExpression[arguments.length=0] > MemberExpression[property.name='sort'][computed=false]"(callee) { | ||
const calleeObjType = (0, util_1.getConstrainedTypeAtLocation)(services, callee.object); | ||
if (options.ignoreStringArrays && isStringArrayNode(callee.object)) { | ||
return; | ||
} | ||
if ((0, util_1.isTypeArrayTypeOrUnionOfArrayTypes)(calleeObjType, checker)) { | ||
context.report({ node: callee.parent, messageId: 'requireCompare' }); | ||
} | ||
}, | ||
"CallExpression[arguments.length=0] > MemberExpression[property.name='sort'][computed=false]": checkSortArgument, | ||
"CallExpression[arguments.length=0] > MemberExpression[property.name='toSorted'][computed=false]": checkSortArgument, | ||
}; | ||
@@ -61,0 +63,0 @@ }, |
@@ -78,4 +78,4 @@ --- | ||
Likewise, if you don't want functions that return promises where a void return is | ||
expected to be checked, your configuration will look like this: | ||
Likewise, if you don't want to check functions that return promises where a void return is | ||
expected, your configuration will look like this: | ||
@@ -82,0 +82,0 @@ ```json |
--- | ||
description: 'Require `Array#sort` calls to always provide a `compareFunction`.' | ||
description: 'Require `Array#sort` and `Array#toSorted` calls to always provide a `compareFunction`.' | ||
--- | ||
@@ -9,3 +9,3 @@ | ||
When called without a compare function, `Array#sort()` converts all non-undefined array elements into strings and then compares said strings based off their UTF-16 code units [[ECMA specification](https://www.ecma-international.org/ecma-262/9.0/#sec-sortcompare)]. | ||
When called without a compare function, `Array#sort()` and `Array#toSorted()` converts all non-undefined array elements into strings and then compares said strings based off their UTF-16 code units [[ECMA specification](https://www.ecma-international.org/ecma-262/9.0/#sec-sortcompare)]. | ||
@@ -19,7 +19,7 @@ The result is that elements are sorted alphabetically, regardless of their type. | ||
This rule reports on any call to the `Array#sort()` method that doesn't provide a `compare` argument. | ||
This rule reports on any call to the sort methods that do not provide a `compare` argument. | ||
## Examples | ||
This rule aims to ensure all calls of the native `Array#sort` method provide a `compareFunction`, while ignoring calls to user-defined `sort` methods. | ||
This rule aims to ensure all calls of the native sort methods provide a `compareFunction`, while ignoring calls to user-defined methods. | ||
@@ -26,0 +26,0 @@ <!--tabs--> |
{ | ||
"name": "@typescript-eslint/eslint-plugin", | ||
"version": "6.14.0", | ||
"version": "6.15.0", | ||
"description": "TypeScript plugin for ESLint", | ||
@@ -60,6 +60,6 @@ "files": [ | ||
"@eslint-community/regexpp": "^4.5.1", | ||
"@typescript-eslint/scope-manager": "6.14.0", | ||
"@typescript-eslint/type-utils": "6.14.0", | ||
"@typescript-eslint/utils": "6.14.0", | ||
"@typescript-eslint/visitor-keys": "6.14.0", | ||
"@typescript-eslint/scope-manager": "6.15.0", | ||
"@typescript-eslint/type-utils": "6.15.0", | ||
"@typescript-eslint/utils": "6.15.0", | ||
"@typescript-eslint/visitor-keys": "6.15.0", | ||
"debug": "^4.3.4", | ||
@@ -77,4 +77,4 @@ "graphemer": "^1.4.0", | ||
"@types/natural-compare": "*", | ||
"@typescript-eslint/rule-schema-to-typescript-types": "6.14.0", | ||
"@typescript-eslint/rule-tester": "6.14.0", | ||
"@typescript-eslint/rule-schema-to-typescript-types": "6.15.0", | ||
"@typescript-eslint/rule-tester": "6.15.0", | ||
"ajv": "^6.12.6", | ||
@@ -108,3 +108,3 @@ "chalk": "^5.3.0", | ||
}, | ||
"gitHead": "c7d702f4315f66c75ae16a4b559ef5b4705bb804" | ||
"gitHead": "6128a02cb15d500fe22fe265c83e4d7a73ae52c3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2530623
508
30145
+ Added@typescript-eslint/scope-manager@6.15.0(transitive)
+ Added@typescript-eslint/type-utils@6.15.0(transitive)
+ Added@typescript-eslint/types@6.15.0(transitive)
+ Added@typescript-eslint/typescript-estree@6.15.0(transitive)
+ Added@typescript-eslint/utils@6.15.0(transitive)
+ Added@typescript-eslint/visitor-keys@6.15.0(transitive)
- Removed@typescript-eslint/scope-manager@6.14.0(transitive)
- Removed@typescript-eslint/type-utils@6.14.0(transitive)
- Removed@typescript-eslint/types@6.14.0(transitive)
- Removed@typescript-eslint/typescript-estree@6.14.0(transitive)
- Removed@typescript-eslint/utils@6.14.0(transitive)
- Removed@typescript-eslint/visitor-keys@6.14.0(transitive)