Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main'
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Dec 11, 2023
2 parents 6de5e0c + 5965faf commit 8a357c8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
12 changes: 11 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
"projectManagement",
"tool"
]
},
{
"login": "styleshit",
"name": "StyleShit",
"avatar_url": "https://avatars.githubusercontent.com/u/32631382?v=4",
"profile": "https://evyatar.tk",
"contributions": [
"bug"
]
}
],
"contributorsPerLine": 7,
Expand All @@ -29,5 +38,6 @@
"projectName": "eslint-plugin-never-disable",
"projectOwner": "JoshuaKGoldberg",
"repoHost": "https://github.com",
"repoType": "github"
"repoType": "github",
"commitType": "docs"
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [0.1.2](https://github.com/JoshuaKGoldberg/eslint-plugin-never-disable/compare/0.1.1...0.1.2) (2023-12-11)

### Bug Fixes

- rule throws error for non `eslint-disable` comments ([8024e9d](https://github.com/JoshuaKGoldberg/eslint-plugin-never-disable/commit/8024e9d92c6fc2ba4fc6e8a114944f1e252168d5))

## [0.1.1](https://github.com/JoshuaKGoldberg/eslint-plugin-never-disable/compare/0.1.0...0.1.1) (2023-12-07)

### Bug Fixes
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p align="center">
<!-- prettier-ignore-start -->
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a href="#contributors" target="_blank"><img alt="All Contributors: 1 👪" src="https://img.shields.io/badge/all_contributors-1_👪-21bb42.svg" /></a>
<a href="#contributors" target="_blank"><img alt="All Contributors: 2 👪" src="https://img.shields.io/badge/all_contributors-2_👪-21bb42.svg" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- prettier-ignore-end -->
<a href="https://codecov.io/gh/JoshuaKGoldberg/eslint-plugin-never-disable" target="_blank"><img alt="Codecov Test Coverage" src="https://codecov.io/gh/JoshuaKGoldberg/eslint-plugin-never-disable/branch/main/graph/badge.svg"/></a>
Expand Down Expand Up @@ -69,6 +69,7 @@ Rule 'rule-to-never-disable' should not be disabled. Explanation for why this is
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com/"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg ✨"/><br /><sub><b>Josh Goldberg ✨</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-never-disable/commits?author=JoshuaKGoldberg" title="Code">💻</a> <a href="#content-JoshuaKGoldberg" title="Content">🖋</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-never-disable/commits?author=JoshuaKGoldberg" title="Documentation">📖</a> <a href="#ideas-JoshuaKGoldberg" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="#projectManagement-JoshuaKGoldberg" title="Project Management">📆</a> <a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://evyatar.tk"><img src="https://avatars.githubusercontent.com/u/32631382?v=4?s=100" width="100px;" alt="StyleShit"/><br /><sub><b>StyleShit</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-never-disable/issues?q=author%3Astyleshit" title="Bug reports">🐛</a></td>
</tr>
</tbody>
</table>
Expand Down
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-never-disable",
"version": "0.1.1",
"version": "0.1.2",
"description": "ESLint plugin to completely ban disabling specific rules. 🙅",
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions src/rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,9 @@ ruleTester.run("rules", rules, {
code: `/* eslint-disable one-var, no-template-curly-in-string, no-var */`,
options: [{ rules: [{ message: "Do not want.", rule: "curly" }] }],
},
{
code: `/* we-should-never-eslint-disable one-var */`,
options: [{ rules: [{ message: "Do not want.", rule: "one-var" }] }],
},
],
});
4 changes: 2 additions & 2 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export const rules: TSESLint.RuleModule<MessageIds, [Options]> = createRule<
message,
rule,
tester: new RegExp(
`eslint-disable(?:-next-line)?\\s+.*(?<=,|\\s)${rule}(?=,|\\s|$)`,
`^eslint-disable(?:-next-line)?\\s+.*(?<=,|\\s)${rule}(?=,|\\s|$)`,
),
}));

return {
Program() {
for (const comment of context.sourceCode.getAllComments()) {
for (const ruleBan of ruleBans) {
if (ruleBan.tester.test(comment.value)) {
if (ruleBan.tester.test(comment.value.trim())) {
context.report({
data: {
message: ruleBan.message,
Expand Down

0 comments on commit 8a357c8

Please sign in to comment.