enable some new linting rules

This commit is contained in:
Denis Pushkarev
2025-04-27 21:55:30 +07:00
parent 67b9fcda44
commit d99a503a58
3 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ async function getModulesForEntryPoint(path, parent) {
return getModulesForEntryPoint(dependency, entry);
}));
return helpers.intersection(result.flat(1), modules);
return helpers.intersection(result.flat(), modules);
}
const entriesList = await glob([
+7 -1
View File
@@ -613,9 +613,13 @@ const base = {
'unicorn/no-thenable': ERROR,
// disallow comparing `undefined` using `typeof` when it's not required
'unicorn/no-typeof-undefined': ERROR,
// disallow using 1 as the depth argument of `Array#flat()`
'unicorn/no-unnecessary-array-flat-depth': ERROR,
// disallow using `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#{ splice, toSpliced }()`
'unicorn/no-unnecessary-array-splice-count': ERROR,
// disallow awaiting non-promise values
'unicorn/no-unnecessary-await': ERROR,
// disallow using `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#{splice,toSpliced}()
// disallow using `.length` or `Infinity` as the end argument of `{ Array, String, %TypedArray% }#slice()`
'unicorn/no-unnecessary-slice-end': ERROR,
// disallow unreadable array destructuring
'unicorn/no-unreadable-array-destructuring': ERROR,
@@ -1971,6 +1975,8 @@ const packagesPackageJSON = {
'package-json/repository-shorthand': [ERROR, { form: 'object' }],
// requires the `author` property to be present
'package-json/require-author': ERROR,
// requires the `description` property to be present
'package-json/require-description': ERROR,
// requires the `engines` property to be present
// TODO: core-js@4
// 'package-json/require-engines': ERROR,
+1
View File
@@ -11,6 +11,7 @@ QUnit.test('Array#flat', assert => {
assert.deepEqual([].flat(), []);
const array = [1, [2, 3], [4, [5, 6]]];
assert.deepEqual(array.flat(0), array);
// eslint-disable-next-line unicorn/no-unnecessary-array-flat-depth -- testing
assert.deepEqual(array.flat(1), [1, 2, 3, 4, [5, 6]]);
assert.deepEqual(array.flat(), [1, 2, 3, 4, [5, 6]]);
assert.deepEqual(array.flat(2), [1, 2, 3, 4, 5, 6]);