Skip to content

Commit

Permalink
fix: bump ESLint-related packages to latest (#468)
Browse files Browse the repository at this point in the history
<!-- 👋 Hi, thanks for sending a PR to eslint-plugin-expect-type! 💖.
Please fill out all fields below and make sure each item is true and [x]
checked.
Otherwise we may not be able to review your PR. -->

## PR Checklist

- [x] Addresses an existing open issue: fixes #463; fixes #465
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/eslint-plugin-expect-type/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/eslint-plugin-expect-type/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

This includes allowing `@typescript-eslint/utils@8`.
  • Loading branch information
JoshuaKGoldberg authored Sep 10, 2024
1 parent 4a117be commit 0969206
Show file tree
Hide file tree
Showing 14 changed files with 513 additions and 479 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

167 changes: 0 additions & 167 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm build
- run: pnpm lint

name: Lint
Expand Down
159 changes: 159 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
const eslint = require("@eslint/js");
const comments = require("@eslint-community/eslint-plugin-eslint-comments/configs");
const vitest = require("@vitest/eslint-plugin");
const eslintPlugin = require("eslint-plugin-eslint-plugin");
const jsdoc = require("eslint-plugin-jsdoc");
const jsonc = require("eslint-plugin-jsonc");
const markdown = require("eslint-plugin-markdown");
const n = require("eslint-plugin-n");
const {
default: packageJson,
} = require("eslint-plugin-package-json/configs/recommended");
const perfectionist = require("eslint-plugin-perfectionist");
const regexp = require("eslint-plugin-regexp");
const yml = require("eslint-plugin-yml");
const tseslint = require("typescript-eslint");

module.exports = tseslint.config(
{
ignores: [
"coverage",
"lib",
"node_modules",
"pnpm-lock.yaml",
"**/*.snap*",
],
},
{
linterOptions: {
reportUnusedDisableDirectives: "error",
},
},
eslint.configs.recommended,
...jsonc.configs["flat/recommended-with-json"],
...markdown.configs.recommended,
...yml.configs["flat/recommended"],
...yml.configs["flat/prettier"],
comments.recommended,
eslintPlugin.configs["flat/recommended"],
jsdoc.configs["flat/contents-typescript-error"],
jsdoc.configs["flat/logical-typescript-error"],
jsdoc.configs["flat/stylistic-typescript-error"],
n.configs["flat/recommended"],
packageJson,
perfectionist.configs["recommended-natural"],
regexp.configs["flat/recommended"],
...tseslint.config({
extends: [
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
],
files: ["**/*.js", "**/*.ts"],
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: [".*.js", "*.ts"],
defaultProject: "./tsconfig.json",
},
tsconfigRootDir: __dirname,
},
},
rules: {
// These on-by-default rules work well for this repo if configured
"@typescript-eslint/no-unnecessary-condition": [
"error",
{
allowConstantLoopConditions: true,
},
],
"@typescript-eslint/no-unused-vars": ["error", { caughtErrors: "all" }],

"@typescript-eslint/prefer-nullish-coalescing": [
"error",
{ ignorePrimitives: true },
],
"@typescript-eslint/restrict-template-expressions": [
"error",
{ allowBoolean: true, allowNullish: true, allowNumber: true },
],

// These on-by-default rules don't work well for this repo and we like them off.
"jsdoc/lines-before-block": "off",
// These off-by-default rules work well for this repo and we like them on.
"logical-assignment-operators": [
"error",
"always",
{ enforceForIfStatements: true },
],
"n/no-unsupported-features/node-builtins": [
"error",
{ allowExperimental: true },
],
"no-constant-condition": "off",
// Stylistic concerns that don't interfere with Prettier
"no-useless-rename": "error",
"object-shorthand": "error",

"operator-assignment": "error",
"perfectionist/sort-objects": [
"error",
{
order: "asc",
partitionByComment: true,
type: "natural",
},
],
},
}),
{
files: ["**/tsconfig.json"],
rules: {
"jsonc/comma-dangle": "off",
"jsonc/no-comments": "off",
"jsonc/sort-keys": "error",
},
},
{
extends: [tseslint.configs.disableTypeChecked],
files: ["**/*.md/*.ts"],
rules: {
// Ignore unused code, as they're often commented with the plugin
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-unused-vars": "off",
},
},
{
files: ["**/*.test.*"],
languageOptions: {
globals: vitest.environments.env.globals,
},
plugins: { vitest },
rules: {
...vitest.configs.recommended.rules,

// These on-by-default rules aren't useful in test files.
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
},
},
{
files: ["**/*.{yml,yaml}"],
rules: {
"yml/file-extension": ["error", { extension: "yml" }],
"yml/sort-keys": [
"error",
{
order: { type: "asc" },
pathPattern: "^.*$",
},
],
"yml/sort-sequence-values": [
"error",
{
order: { type: "asc" },
pathPattern: "^.*$",
},
],
},
},
);
3 changes: 1 addition & 2 deletions knip.jsonc → knip.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "https://unpkg.com/knip@latest/schema.json",
"entry": ["src/index.ts!"],
"ignore": "src/rules/sandbox/**/*",
"entry": ["src/index.ts!", "src/rules/*.test.ts"],
"ignoreExportsUsedInFile": { "interface": true, "type": true },
"project": ["src/**/*.ts!"]
}
Loading

0 comments on commit 0969206

Please sign in to comment.