Open
Description
Hi there,
I have updated my project to ESLint 9 and all packages required for this to the latest version. Among all these packages I eslint-config-xo-typescript
to enable linting for TypeScript files. Two issues arise from this:
- In my case the file extension is
.ts
buteslint-config-xo-typescript
uses.tsx
, therefore I have to adjust the configuration somehow and the only solution I found was mangling the configuration object like
// eslint.config.mjs
import xoTypeScript from 'eslint-config-xo-typescript';
const tsxConfigurationObject = xoTypeScript[xoTypeScript.length - 1];
// Include .ts files in liniting, required because file extension .tsx is configured by default
tsxConfigurationObject.files.push('**/*.ts');
export default [
...xoTypeScript
];
- With the update to ESLint 9 the config file needs to use the
.mjs
extension to have the config file linted correctly but this causes addtional errors thrown by the project service. To fix this the following configuration is needed:
// eslint.config.mjs
import xoTypeScript from 'eslint-config-xo-typescript';
const tsConfigurationObject = xoTypeScript[1];
// https://github.com/typescript-eslint/typescript-eslint/issues/9739#issuecomment-2296442418
tsConfigurationObject.languageOptions.parserOptions.projectService = {
allowDefaultProject: ['eslint.config.mjs'],
...
};
export default [
...xoTypeScript
];
TLDR;
I need to mangle with the configuration object returned from import
. The use of index-based access raises a warning flag on my side because this could break easily. So, is there another way to adjust the configuration or is there any plan to support adjustments?
Metadata
Assignees
Labels
No labels
Activity