I'm trying to add an ignores
object to the typescript-eslint configuration
I figured this would do the trick:
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
).push({
ignores: ["build/*"]
});
However when running npx eslint .
it produces this error:
Oops! Something went wrong! :(
ESLint: 8.57.0
TypeError: All arguments must be objects.
at ObjectSchema.merge (/Users/oleersoy/Github/fs-typescript-starter/node_modules/@humanwhocodes/object-schema/src/object-schema.js:234:19)
at /Users/oleersoy/Github/fs-typescript-starter/node_modules/@humanwhocodes/config-array/api.js:935:42
at Array.reduce (<anonymous>)
at FlatConfigArray.getConfig (/Users/oleersoy/Github/fs-typescript-starter/node_modules/@humanwhocodes/config-array/api.js:934:39)
at FlatConfigArray.isFileIgnored (/Users/oleersoy/Github/fs-typescript-starter/node_modules/@humanwhocodes/config-array/api.js:962:15)
at /Users/oleersoy/Github/fs-typescript-starter/node_modules/eslint/lib/eslint/eslint-helpers.js:312:49
at Array.reduce (<anonymous>)
at entryFilter (/Users/oleersoy/Github/fs-typescript-starter/node_modules/eslint/lib/eslint/eslint-helpers.js:299:28)
at Object.isAppliedFilter (/Users/oleersoy/Github/fs-typescript-starter/node_modules/@nodelib/fs.walk/out/readers/common.js:12:31)
at AsyncReader._handleEntry (/Users/oleersoy/Github/fs-typescript-starter/node_modules/@nodelib/fs.walk/out/readers/async.js:86:20)
How should we go about extending the configuration to add ignores
?
config
expects objects; push
acts on arrays.
Just add the additional rule object:
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
ignores: ["build/*"]
}
);
See here for the documentation.