Skip to content

Commit

Permalink
Fix eslint-disable comment format checking
Browse files Browse the repository at this point in the history
  • Loading branch information
polklabs committed Jan 5, 2024
1 parent 4b4bb08 commit df7d0ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-assorted-rules",
"version": "1.1.4",
"version": "1.1.5",
"description": "plugin for custom eslint rules",
"main": "./index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/file-lint-disable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type MessageIds = "fileLintDisableRequired";
export type Options = [];

// The 'X?' is used so I can run tests without Jest complaining about disabling non-existent eslint rules
const regex = /\/\*\s*eslint-disableX?\s*.+?\s*\*\//gms;
const regex = /\/\*\s*eslint-disableX?\s+.+?\s*\*\//gms;

export default createEslintRule<Options, MessageIds>({
name: RULE_NAME,
Expand Down
9 changes: 9 additions & 0 deletions tests/rules/file-lint-disable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ const validStatements = [
}
}
`,
`
function x() {
/* eslint-disableX-next-line @typescript-eslint/no-unused-vars */
let a: any = 0
for(let i = 0; i < 12; i++) {
a++;
}
}
`,
];
const invalidStatemets = [
`
Expand Down

0 comments on commit df7d0ee

Please sign in to comment.