Skip to content

Commit

Permalink
Merge pull request #21 from pandell/eslint-upgrade
Browse files Browse the repository at this point in the history
@pandell/eslint-config: eslint 9.21, typescript-eslint 8.25, other NPM updates as of 2025-02-27
  • Loading branch information
milang authored Feb 28, 2025
2 parents b979508 + ee7639b commit a05f203
Show file tree
Hide file tree
Showing 13 changed files with 410 additions and 412 deletions.
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// spell-checker:words davidanson dbaeumer esbenp fwcd ktfmt mathiasfrohlich wallabyjs
{
"recommendations": [
"davidanson.vscode-markdownlint",
Expand Down
54 changes: 32 additions & 22 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
// spell-checker:ignore anson colour esbenp fwcd ktfmt otbs yalc
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},

"files.exclude": {
"**/.DS_Store": true
},

"search.exclude": {
".yalc": true,
".yarn": true
".yarn": true,
"**/dist": true
},

"typescript.tsdk": "node_modules/typescript/lib",
Expand All @@ -16,27 +22,28 @@
// settings for extensions below

// spell checker settings
"cSpell.ignorePaths": [".git", ".vscode", "node_modules", "yarn.lock"],
"cSpell.ignorePaths": [".git", "node_modules", "yarn.lock"],
"cSpell.language": "en-US",
"cSpell.enableFiletypes": [
"asciidoc",
"csharp",
"editorconfig",
"git-commit",
"ignore",
"javascript",
"javascriptreact",
"json",
"jsonc",
"log",
"markdown",
"plaintext",
"powershell",
"properties",
"text",
"typescript",
"typescriptreact"
],
"cSpell.enabledFileTypes": {
"asciidoc": true,
"csharp": true,
"css": true,
"editorconfig": true,
"git-commit": true,
"html": true,
"ignore": true,
"javascript": true,
"javascriptreact": true,
"json": true,
"jsonc": true,
"markdown": true,
"plaintext": true,
"powershell": true,
"properties": true,
"text": true,
"typescript": true,
"typescriptreact": true
},
"cSpell.flagWords": ["colour"],
"cSpell.words": [
"chriscoyier",
Expand Down Expand Up @@ -107,7 +114,10 @@
"editor.formatOnSave": false // 2023-12-12, milang: -||-
},
"[markdown]": {
"editor.defaultFormatter": "davidanson.vscode-markdownlint"
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"[svg]": {
"editor.formatOnSave": false
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"devDependencies": {
"@pandell/eslint-config": "workspace:packages/eslint-config",
"browserslist": "^4.24.4",
"eslint": "^9.20.1",
"eslint": "^9.21.0",
"eslint-formatter-teamcity": "^1.0.0",
"prettier": "^3.5.0",
"prettier": "^3.5.2",
"typescript": "^5.7.3"
},
"eslint-formatter-teamcity": {
Expand Down
3 changes: 0 additions & 3 deletions packages/eslint-config/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
/*.js
/*.json.md
/*.tsbuildinfo
/tsconfig.json
4 changes: 2 additions & 2 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Add the following to your `package.json`:
```jsonc
{
"devDependencies": {
"@pandell/eslint-config": "^9.10.0",
"eslint": "^9.20.1",
"@pandell/eslint-config": "^9.11.0",
"eslint": "^9.21.0",
// ...
},
// ...
Expand Down
23 changes: 13 additions & 10 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pandell/eslint-config",
"type": "module",
"version": "9.10.0",
"version": "9.11.0",
"description": "Pandell ESLint shared config",
"keywords": [
"eslint",
Expand All @@ -19,29 +19,32 @@
"name": "Pandell Technology Corporation",
"url": "https://github.com/pandell"
},
"main": "dist/pandellEsLintConfig.js",
"types": "dist/pandellEsLintConfig.d.ts",
"module": "./dist/pandellEsLintConfig.js",
"exports": {
"types": "./dist/pandellEsLintConfig.d.ts",
"default": "./dist/pandellEsLintConfig.js"
},
"scripts": {
"prepack": "node ../../tools/clean-package-json.mjs"
},
"dependencies": {
"@eslint-react/eslint-plugin": "^1.26.2",
"@eslint/js": "^9.20.0",
"@eslint-react/eslint-plugin": "^1.28.0",
"@eslint/js": "^9.21.0",
"@tanstack/eslint-plugin-query": "^5.66.1",
"@typescript-eslint/utils": "^8.24.0",
"@vitest/eslint-plugin": "^1.1.30",
"eslint-import-resolver-typescript": "^3.7.0",
"@typescript-eslint/utils": "^8.25.0",
"@vitest/eslint-plugin": "^1.1.36",
"eslint-import-resolver-typescript": "^3.8.3",
"eslint-plugin-import-x": "^4.6.1",
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-jsdoc": "^50.6.3",
"eslint-plugin-react-hooks": "5.1.0",
"eslint-plugin-react-refresh": "^0.4.19",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-testing-library": "^7.1.1",
"typescript-eslint": "^8.24.0"
"typescript-eslint": "^8.25.0"
},
"devDependencies": {
"eslint": "^9.20.1",
"eslint": "^9.21.0",
"typescript": "^5.7.3"
},
"peerDependencies": {
Expand Down
34 changes: 29 additions & 5 deletions packages/eslint-config/package.json.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
# Notes for "package.json"
# Notes for "eslint-config/package.json"

NodeJS/NPM don't allow comments in `package.json`, so we keep
notes and comments in this markdown file.

- [Properties](#properties)
- [Dependencies](#dependencies)
- [Resolutions](#resolutions)

## Properties

### "module"

According to Node [documentation](https://nodejs.org/docs/latest-v22.x/api/packages.html#package-entry-points),
`"module"` should not be needed when `package.json` defines an `"exports"` property.
However, as of 2025-02-26 the following reports an `import-x` error:

```js
// eslint.config.mjs

// @ts-check

import { createPandellEsLintConfig } from "@pandell/eslint-config";
// error: import-x/no-unresolved: Unable to resolve path to module '@pandell/eslint-config'
```

No such error is reported when `@pandell/eslint-config/package.json` contains `"module"`

Remove this property when `import-x` no longer reports this resolution error.

## Dependencies

- `eslint-plugin-testing-library`
2024-06-14, milang: See note 1 in [README.md](README.md). Optional peer dependency
should be deleted and `eslint-plugin-testing-library` should be converted to regular
`dependency` when it adds support for ESLint 9 (version 7?).
All dependencies are up-to-date at this time.

## Resolutions

No resolutions are needed at this time.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// No typings are available for "eslint-plugin-react-hooks@5.x.x" as of 2025-02-26.

declare module "eslint-plugin-react-hooks" {
import type { ESLint } from "eslint";

export const configs: {
recommended: {
rules: {
readonly recommended: {
readonly rules: {
"react-hooks/rules-of-hooks": "error";
"react-hooks/exhaustive-deps": "warn";
};
Expand Down
16 changes: 6 additions & 10 deletions packages/eslint-config/src/pandellEsLintConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ async function createPandellTestingConfig(
}
if (vitest) {
configs.push({
...vitest.default.configs.recommended,
...(vitest.default.configs.recommended as unknown as Linter.Config),
name: "vitest/recommended",
files: resolvedFiles,
});
Expand Down Expand Up @@ -366,11 +366,7 @@ function createPandellViteConfig(
settings: PandellEsLintConfigSettings,
): ReadonlyArray<Linter.Config> {
const { vite = {} } = settings;
const {
enabled = false,
tsConfigPath = "tsconfig.node.json",
viteConfigPath = "vite.config.ts",
} = vite;
const { enabled = false, tsConfigPath = "tsconfig.node.json", files = ["vite.config.ts"] } = vite;

if (!enabled) {
return [];
Expand All @@ -379,7 +375,7 @@ function createPandellViteConfig(
return [
{
name: "@pandell-eslint-config/vite",
files: [viteConfigPath],
files,
languageOptions: { parserOptions: { project: tsConfigPath } },
},
];
Expand Down Expand Up @@ -635,11 +631,11 @@ export interface PandellEsLintConfigSettings {
readonly tsConfigPath?: string;

/**
* Sets the Vite configuration file path (used to set "files" for the configuration layer).
* Sets the files that will be analyzed with Vite's "tsConfigPath".
*
* @default "vite.config.ts"
* @default ["vite.config.ts"]
*/
readonly viteConfigPath?: string;
readonly files?: string[];
};
}

Expand Down
6 changes: 4 additions & 2 deletions packages/eslint-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@pandell/typescript-config",
"compilerOptions": {
"declaration": true,
"module": "NodeNext",
"moduleResolution": "nodenext",
"outDir": "dist",
"rootDir": "src",
"tsBuildInfoFile": "../../node_modules/.cache/typescript/eslint-config.tsbuildinfo"
},
"include": ["src", "typings"]
}
}
12 changes: 0 additions & 12 deletions packages/eslint-config/typings/eslint.d.ts

This file was deleted.

37 changes: 0 additions & 37 deletions packages/eslint-config/typings/testing.d.ts

This file was deleted.

Loading

0 comments on commit a05f203

Please sign in to comment.