Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ jobs:
run: npm install
- name: Check Types
run: npm run test:types
- name: Check Types (TypeScript 5.x)
run: npm run test:types:5.x
- name: Check Types (TypeScript 5.3)
run: npm run test:types:5.3
are_the_types_wrong:
name: Are the types wrong?
runs-on: ubuntu-latest
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@
"test": "mocha \"tests/**/*.test.js\"",
"test:coverage": "c8 npm test",
"test:jsr": "npx -y jsr@latest publish --dry-run",
"test:types": "npm run build && tsc -p tests/types/tsconfig.json"
"test:types": "npm run build && tsc -p tests/types/tsconfig.json",
"test:types:5.x": "npx -p typescript@5.x -y -- tsc -p tests/types/tsconfig.json",
"test:types:5.3": "npx -p typescript@5.3 -y -- tsc -p tests/types/tsconfig.json",
"test:types:all": "npm run test:types && npm run test:types:5.x && npm run test:types:5.3"
},
"keywords": [
"eslint",
Expand Down Expand Up @@ -89,7 +92,7 @@
"mocha": "^11.0.0",
"prettier": "3.8.2",
"tailwind-csstree": "^0.3.0",
"typescript": "^5.9.3",
"typescript": "^6.0.3",
"web-features": "^3.23.1",
"yorkie": "^2.0.0"
},
Expand Down
5 changes: 1 addition & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ const plugin = {
},
};

// eslint-disable-next-line no-lone-blocks -- The block syntax { ... } ensures that TypeScript does not get confused about the type of `plugin`.
{
plugin.configs.recommended.plugins.css = plugin;
}
Object.assign(plugin.configs.recommended.plugins, { css: plugin });

export default plugin;
export { CSSSourceCode };
Expand Down
8 changes: 4 additions & 4 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@

/**
* Determines if an error is a syntax match error.
* @param {Object} error The error object to check.
* @param {SyntaxMatchError | SyntaxReferenceError | Error} error The error object to check.
* @returns {error is SyntaxMatchError} True if the error is a syntax match error, false if not.
*/
export function isSyntaxMatchError(error) {
return typeof error.syntax === "string";
return "syntax" in error && typeof error.syntax === "string";
}

/**
* Determines if an error is a syntax reference error.
* @param {Object} error The error object to check.
* @param {SyntaxMatchError | SyntaxReferenceError | Error} error The error object to check.
* @returns {error is SyntaxReferenceError} True if the error is a syntax reference error, false if not.
*/
export function isSyntaxReferenceError(error) {
return typeof error.reference === "string";
return "reference" in error && typeof error.reference === "string";
}
5 changes: 5 additions & 0 deletions tests/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"allowJs": false,
"checkJs": false,
"noEmit": true,
"rootDir": "../..",
"strict": true,
"strictNullChecks": true,
"useUnknownInCatchVariables": true,
"noImplicitAny": true,
"exactOptionalPropertyTypes": true
},
"files": [],
Expand Down
4 changes: 4 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"lib": ["ES2022"],
"moduleResolution": "NodeNext",
"module": "NodeNext",
"rootDir": "./src",
"strictNullChecks": false,
"useUnknownInCatchVariables": false,
"noImplicitAny": false,
"types": []
}
}