Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ESLint and other deps #372

Merged
merged 6 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/grumpy-bobcats-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'eslint-config-sheriff': minor
'@sherifforg/create-config': minor
'@sherifforg/cli': minor
---

feat(plugins): updated eslint and plugins
Closes #354
Closes #371
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
"markdown",
"astro"
],
"eslint.options": {
"flags": ["unstable_ts_config"]
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
Expand Down
2 changes: 1 addition & 1 deletion apps/config-validation-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@types/node": "^22.10.3",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"eslint": "^9.17.0",
"eslint": "^9.19.0",
"eslint-config-sheriff": "workspace:*",
"tsconfig": "workspace:*",
"typescript": "^5.6.3"
Expand Down
2 changes: 1 addition & 1 deletion apps/docs-website/docs/requirements/recommendations.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: You probably need this too
# Recommendations

- [Node >=22](https://nodejs.org/en/)
- [ESLint >=9.0.0](https://eslint.org/)
- [ESLint >=9.19.0](https://eslint.org/)
- [Typescript >= 5.0.0](https://www.typescriptlang.org/)
- [VScode](https://code.visualstudio.com/)
- [VScode eslint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
Expand Down
2 changes: 1 addition & 1 deletion apps/docs-website/docs/setup/manual-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Follow these steps:

If you want to have a `.ts` configuration file ([learn more](../typescript-support/eslint-config-ts.md)) instead of the default `.js` file, follow these steps:

- make sure your installed ESLint version is `>=9.9.0`
- make sure your installed ESLint version is `>=9.9.0` (preferably `>=9.18.0`. [See why](../vscode-support.md##eslintconfigts-support))
- install [jiti](https://github.com/unjs/jiti)
```bash npm2yarn
npm install -D jiti
Expand Down
10 changes: 9 additions & 1 deletion apps/docs-website/docs/vscode-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ For [Astro](https://astro.build/) projects, add the astro extension too:

## `eslint.config.ts` support

If you are using the `eslint.config.ts` config, add this to your `.vscode/settings.json`:
Follow these instructions if you are using the `eslint.config.ts` configuration file.

### With ESLint >= 9.18.0

No further action is required. You are good to go!

### With ESLint < 9.18.0

Add this to your `.vscode/settings.json`:

```JSONC title=".vscode/settings.json"
"eslint.options": {
Expand Down
4 changes: 2 additions & 2 deletions apps/docs-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
"lint": "eslint --max-warnings=0 --flag unstable_ts_config",
"lint": "eslint --max-warnings=0",
"clean": "pnpm clear && rm -rf .turbo dist node_modules/.cache"
},
"dependencies": {
Expand Down Expand Up @@ -44,7 +44,7 @@
"@types/node": "^22.10.3",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"eslint": "^9.17.0",
"eslint": "^9.19.0",
"eslint-config-sheriff": "workspace:*",
"eslint-plugin-mdx": "^3.1.5",
"jiti": "^2.4.2",
Expand Down
16 changes: 8 additions & 8 deletions apps/sheriff-webservices/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "tsx watch ./src/index.ts",
"build": "tsc",
"typecheck": "tsc",
"lint": "eslint --max-warnings=0 --flag unstable_ts_config",
"lint": "eslint --max-warnings=0",
"serve": "node ./dist/index.js",
"clean": "rm -rf .turbo dist node_modules/.cache"
},
Expand All @@ -22,13 +22,13 @@
},
"dependencies": {
"@eslint-react/eslint-plugin": "^1.10.1",
"@eslint/js": "^9.17.0",
"@eslint/js": "^9.19.0",
"@hono/node-server": "^1.7.0",
"@next/eslint-plugin-next": "^13.2.3",
"@next/eslint-plugin-next": "^15.1.6",
"@regru/eslint-plugin-prefer-early-return": "^1.0.0",
"@stylistic/eslint-plugin": "^2.6.4",
"@vitest/eslint-plugin": "^1.0.3",
"eslint": "^9.17.0",
"@vitest/eslint-plugin": "^1.1.25",
"eslint": "^9.19.0",
"eslint-config-sheriff": "workspace:*",
"eslint-plugin-arrow-return-style": "^1.3.0",
"eslint-plugin-astro": "^1.2.3",
Expand All @@ -42,16 +42,16 @@
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-regexp": "^2.6.0",
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-remeda": "^1.4.0",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-sonarjs": "^1.0.4",
"eslint-plugin-storybook": "^0.10.2",
"eslint-plugin-tsdoc": "^0.2.17",
"eslint-plugin-unicorn": "^55.0.0",
"eslint-plugin-unicorn": "^56.0.1",
"hono": "^3.12.0",
"lodash": "^4.17.21",
"typescript-eslint": "^8.19.0"
"typescript-eslint": "^8.22.0"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
20 changes: 10 additions & 10 deletions packages/eslint-config-sheriff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@
"build": "tsup && pnpm re-bundle-types",
"build:watch": "tsup --watch",
"typecheck": "tsc",
"lint": "eslint src --max-warnings=0 --flag unstable_ts_config",
"lint": "eslint src --max-warnings=0",
"publint": "publint"
},
"dependencies": {
"@eslint-react/eslint-plugin": "^1.10.1",
"@eslint/compat": "^1.2.4",
"@eslint/js": "^9.17.0",
"@next/eslint-plugin-next": "^13.2.3",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@next/eslint-plugin-next": "^15.1.6",
"@regru/eslint-plugin-prefer-early-return": "^1.0.0",
"@stylistic/eslint-plugin": "^2.6.4",
"@vitest/eslint-plugin": "^1.0.3",
"@vitest/eslint-plugin": "^1.1.25",
"confusing-browser-globals": "^1.0.11",
"eslint-config-flat-gitignore": "^0.3.0",
"eslint-import-resolver-typescript": "^3.6.3",
Expand All @@ -77,16 +77,16 @@
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-regexp": "^2.6.0",
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-remeda": "^1.4.0",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-sonarjs": "^1.0.4",
"eslint-plugin-storybook": "^0.10.2",
"eslint-plugin-tsdoc": "^0.2.17",
"eslint-plugin-unicorn": "^55.0.0",
"eslint-plugin-unicorn": "^56.0.1",
"globals": "^15.11.0",
"lodash": "^4.17.21",
"typescript-eslint": "^8.19.0"
"typescript-eslint": "^8.22.0"
},
"peerDependencies": {
"eslint": ">=9.0.0",
Expand All @@ -104,9 +104,9 @@
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
"@types/lodash": "^4.17.13",
"@types/node": "^22.10.3",
"@typescript-eslint/utils": "^8.19.0",
"@typescript-eslint/utils": "^8.22.0",
"dts-bundle-generator": "^9.5.1",
"eslint": "^9.17.0",
"eslint": "^9.19.0",
"jiti": "^2.4.2",
"publint": "^0.2.10",
"tsconfig": "workspace:*",
Expand Down
9 changes: 7 additions & 2 deletions packages/eslint-config-sheriff/src/getBaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import tseslint from 'typescript-eslint';
import { fixupPluginRules } from '@eslint/compat';
import eslintJs from '@eslint/js';
import preferEarlyReturn from '@regru/eslint-plugin-prefer-early-return';
import { allJsExtensions, supportedFileTypes } from '@sherifforg/constants';
import {
allJsExtensions,
supportedFileTypes,
tsExtensions,
tsxExtensions,
} from '@sherifforg/constants';
import type { SheriffSettings } from '@sherifforg/types';
import stylistic from '@stylistic/eslint-plugin';
import type { TSESLint } from '@typescript-eslint/utils';
Expand Down Expand Up @@ -58,7 +63,7 @@ export const getBaseConfig = (
},
},
{
files: ['**/*.{ts,mts,cts,tsx,mtsx,astro}'],
files: [`**/*.{${tsExtensions},${tsxExtensions},astro}`],
plugins: {
tsdoc,
},
Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-config-sheriff/src/nextjsConfig.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { fixupPluginRules } from '@eslint/compat';
import nextjs from '@next/eslint-plugin-next';
import { supportedFileTypes } from '@sherifforg/constants';
import { allJsExtensions, allJsxExtensions } from '@sherifforg/constants';
import type { TSESLint } from '@typescript-eslint/utils';

export const nextjsConfig: TSESLint.FlatConfig.ConfigArray = [
{
files: [supportedFileTypes],
files: [`**/*.{${allJsExtensions},${allJsxExtensions}}`],
plugins: {
'@next/next': fixupPluginRules(nextjs),
},
Expand All @@ -25,8 +25,8 @@ export const nextjsConfig: TSESLint.FlatConfig.ConfigArray = [
},
{
files: [
'**/page.{js,mjs,cjs,ts,mts,cts,jsx,tsx,mtsx,mjsx}',
'**/layout.{js,mjs,cjs,ts,mts,cts,jsx,tsx,mtsx,mjsx}',
`**/page.{${allJsExtensions},${allJsxExtensions}}`,
`**/layout.{${allJsExtensions},${allJsxExtensions}}`,
],
rules: {
'react-refresh/only-export-components': [
Expand Down
7 changes: 5 additions & 2 deletions packages/sheriff-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"license": "MIT",
"dependencies": {
"@typescript-eslint/typescript-estree": "^8.18.2",
"@typescript-eslint/typescript-estree": "^8.22.0",
"consola": "^3.3.3",
"read-pkg": "^9.0.1",
"yargs": "^17.7.2"
Expand All @@ -26,13 +26,16 @@
"@sherifforg/types": "workspace:*",
"@types/node": "^22.10.3",
"@types/yargs": "^17.0.33",
"eslint": "^9.17.0",
"eslint": "^9.19.0",
"eslint-config-sheriff": "workspace:*",
"publint": "^0.2.10",
"tsconfig": "workspace:*",
"tsup": "^8.3.0",
"typescript": "^5.6.3"
},
"peerDependencies": {
"eslint": ">=9.18.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/AndreaPontrandolfo/sheriff.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/sheriff-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async function main() {

consola.debug('Finished checking dependencies in package.json.');

const eslint = new ESLint({ flags: ['unstable_ts_config'] });
const eslint = new ESLint();

let configFilePath: string | undefined;

Expand Down
12 changes: 10 additions & 2 deletions packages/sheriff-constants/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ export const configCombinationDefaultValues = {
vitest: true,
} as const;

export const allJsExtensions = 'js,mjs,cjs,ts,mts,cts';
export const jsExtensions = 'js,mjs,cjs';

export const allJsxExtensions = 'jsx,tsx,mtsx,mjsx';
export const jsxExtensions = 'jsx,mjsx';

export const tsExtensions = 'ts,mts,cts';

export const tsxExtensions = 'tsx,mtsx';

export const allJsExtensions = `${jsExtensions},${tsExtensions}`;

export const allJsxExtensions = `${jsxExtensions},${tsxExtensions}`;

export const supportedFileTypes = `**/*{${allJsExtensions},${allJsxExtensions},astro}`;

Expand Down
4 changes: 2 additions & 2 deletions packages/sheriff-create-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "tsup",
"build:watch": "tsup --watch",
"typecheck": "tsc",
"lint": "eslint ./src --max-warnings=0 --flag unstable_ts_config",
"lint": "eslint ./src --max-warnings=0",
"publint": "publint"
},
"license": "MIT",
Expand All @@ -33,7 +33,7 @@
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.10.3",
"@types/yargs": "^17.0.33",
"eslint": "^9.17.0",
"eslint": "^9.19.0",
"eslint-config-sheriff": "workspace:*",
"jiti": "^2.4.2",
"publint": "^0.2.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/sheriff-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@sherifforg/types": "workspace:*",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.10.3",
"eslint": "^9.17.0",
"eslint": "^9.19.0",
"eslint-config-sheriff": "workspace:*",
"lodash-es": "^4.17.21",
"publint": "^0.2.10",
Expand Down
Loading