Closed
Description
Environment
ESLint version: 9.26.0
@eslint/css version: 0.7.0
Node version: 22.15.0
npm version: 10.9.2
Operating System: macOS
Which language are you using?
stylesheet
What did you do?
$ mkdir -p /tmp/test && cd "$_"
$ npm init -y
$ npm i -D typescript eslint @eslint/css typescript-eslint
$ cat <<'EOF' >eslint.config.mts
import css from '@eslint/css';
import tseslint from 'typescript-eslint';
import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
const cfg: FlatConfig.ConfigArray = tseslint.config({
files: ['*.css'],
plugins: {css},
language: 'css/css',
rules: {...css.configs.recommended.rules}
});
export default cfg;
EOF
$ echo '{"compilerOptions":{"lib":["es2024"],"skipLibCheck":true,"noEmit":true,"module":"es2022","moduleResolution":"bundler"}}' >tsconfig.json
$ echo 'p{}' >test.css
Check that the ESLint setup works:
$ NODE_OPTIONS="--experimental-strip-types --disable-warning=ExperimentalWarning" npx eslint --flag unstable_native_nodejs_ts_config .
/private/tmp/test/test.css
1:2 error Unexpected empty block found css/no-empty-blocks
✖ 1 problem (1 error, 0 warnings)
The error is OK—the config works.
$ npx tsc
node_modules/@eslint/css/dist/esm/types.ts:34:47 - error TS2304: Cannot find name 'Comment'.
34 export type CSSSyntaxElement = CssNodePlain | Comment;
~~~~~~~
Found 1 error in node_modules/@eslint/css/dist/esm/types.ts:34
This error is unexpected and gives no indication on how to fix it.
What did you expect to happen?
No error or if this is the desired behavior then the docs should be updated to mention the dom
requirement.
What actually happened?
Type error.
Link to Minimal Reproducible Example
minimal reproduction is above
Participation
- I am willing to submit a pull request for this issue.
Additional comments
Adding dom
to lib
will fix the error:
$ echo '{"compilerOptions":{"lib":["es2024","dom"],"skipLibCheck":true,"noEmit":true,"module":"es2022","moduleResolution":"bundler"}}' >tsconfig.json
$ npx tsc
https://www.typescriptlang.org/tsconfig/#lib
I am unsure if it is OK if the DOM
types leak, requiring them might lead to other issues.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Complete