feat: add rules for eslint-disable directives (#11)

### Explanation

_No response_

### Issue

_No response_

### Attestations

- [x] I have read and agree to the [Code of Conduct](https://docs.nhcarrigan.com/community/coc/)
- [x] I have read and agree to the [Community Guidelines](https://docs.nhcarrigan.com/community/guide/).
- [x] My contribution complies with the [Contributor Covenant](https://docs.nhcarrigan.com/dev/covenant/).

### Dependencies

- [x] I have pinned the dependencies to a specific patch version.

### Style

- [x] I have run the linter and resolved any errors.
- [x] My pull request uses an appropriate title, matching the conventional commit standards.
- [x] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request.

### Tests

- [x] My contribution adds new code, and I have added tests to cover it.
- [x] My contribution modifies existing code, and I have updated the tests to reflect these changes.
- [x] All new and existing tests pass locally with my changes.
- [x] Code coverage remains at or above the configured threshold.

### Documentation

_No response_

### Versioning

Minor - My pull request introduces a new non-breaking feature.

Reviewed-on: https://codeberg.org/nhcarrigan/eslint-config/pulls/11
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
This commit is contained in:
2025-01-05 21:25:03 +00:00
committed by Naomi the Technomancer
parent 75d02a9931
commit 39e29181a0
7 changed files with 65 additions and 15 deletions
+17 -4
View File
@@ -5,6 +5,7 @@
*/
import { fixupPluginRules } from "@eslint/compat";
import comments from "@eslint-community/eslint-plugin-eslint-comments";
import stylistic from "@stylistic/eslint-plugin";
import tslint from "@typescript-eslint/eslint-plugin";
import parser from "@typescript-eslint/parser";
@@ -17,6 +18,7 @@ import react from "eslint-plugin-react";
import sortKeysFix from "eslint-plugin-sort-keys-fix";
import unicorn from "eslint-plugin-unicorn";
import globals from "globals";
import { commentsRules } from "./rules/comments.js";
import { deprecationRules } from "./rules/deprecation.js";
import { disabledEslintRules, eslintRules } from "./rules/eslint.js";
import { importRules } from "./rules/import.js";
@@ -50,6 +52,8 @@ const config: Array<Linter.Config> = [
plugins: {
// @ts-expect-error It's a config. It's just not the narrow config. SMH.
"@typescript-eslint": tslint,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Not unsafe, just not typed.
"comments": comments,
// @ts-expect-error They haven't typedef this yet because it technically doesn't support eslint9
"deprecation": fixupPluginRules(deprecation),
"import": fixupPluginRules(importPlugin as ESLint.Plugin),
@@ -70,6 +74,7 @@ const config: Array<Linter.Config> = [
...stylisticRules,
...unicornRules,
...sortKeysFixRules,
...commentsRules,
},
},
// #endregion
@@ -90,6 +95,8 @@ const config: Array<Linter.Config> = [
plugins: {
// @ts-expect-error It's a config. It's just not the narrow config. SMH.
"@typescript-eslint": tslint,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Not unsafe, just not typed.
"comments": comments,
"import": fixupPluginRules(importPlugin as ESLint.Plugin),
"jsdoc": jsdoc,
"sort-keys-fix": sortKeysFix as ESLint.Plugin,
@@ -108,6 +115,7 @@ const config: Array<Linter.Config> = [
...stylisticRules,
...unicornRules,
...sortKeysFixRules,
...commentsRules,
},
},
// #endregion
@@ -128,14 +136,15 @@ const config: Array<Linter.Config> = [
plugins: {
// @ts-expect-error It's a config. It's just not the narrow config. SMH.
"@typescript-eslint": tslint,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Not unsafe, just not typed.
"comments": comments,
"import": fixupPluginRules(importPlugin as ESLint.Plugin),
"jsdoc": jsdoc,
"playwright": playwright,
"sort-keys-fix": sortKeysFix as ESLint.Plugin,
"sort-keys-fix": sortKeysFix as ESLint.Plugin,
// @ts-expect-error They haven't typedef this yet because it technically doesn't support eslint9
"stylistic": fixupPluginRules(stylistic),
"unicorn": unicorn,
"stylistic": fixupPluginRules(stylistic),
"unicorn": unicorn,
},
rules: {
...eslintRules,
@@ -147,6 +156,7 @@ const config: Array<Linter.Config> = [
...stylisticRules,
...unicornRules,
...sortKeysFixRules,
...commentsRules,
},
},
// #endregion
@@ -172,6 +182,8 @@ const config: Array<Linter.Config> = [
plugins: {
// @ts-expect-error It's a config. It's just not the narrow config. SMH.
"@typescript-eslint": tslint,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Not unsafe, just not typed.
"comments": comments,
// @ts-expect-error They haven't typedef this yet because it technically doesn't support eslint9
"deprecation": fixupPluginRules(deprecation),
"import": fixupPluginRules(importPlugin as ESLint.Plugin),
@@ -194,6 +206,7 @@ const config: Array<Linter.Config> = [
...unicornRules,
...sortKeysFixRules,
...reactRules,
...commentsRules,
},
},
];
+12
View File
@@ -0,0 +1,12 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import type { Linter } from "eslint";
export const commentsRules: Linter.RulesRecord = {
"comments/no-unlimited-disable": "warn",
"comments/require-description": "warn",
};
+1
View File
@@ -7,3 +7,4 @@
declare module "eslint-plugin-no-only-tests";
declare module "eslint-plugin-import";
declare module "eslint-plugin-sort-keys-fix";
declare module "@eslint-community/eslint-plugin-eslint-comments";