I try settup eslint with typescript-eslint. My config from docs:
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended
);
In IDE error:
import eslint from '@eslint/js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
You need to set "type": "module" to your package.json file. See https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file
If your project does not specify "type": "module" in its package.json file, then eslint.config.js must be in CommonJS format, such as:
// eslint.config.js
module.exports = [
{
rules: {
semi: "error",
"prefer-const": "error"
}
}
];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With