From e3246546b6255a9607d6770ffc314f7e1f38756c Mon Sep 17 00:00:00 2001 From: Julian Meinking <12785972+DrJume@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:16:12 +0200 Subject: [PATCH] feat(eslint-config)!: upgrade to eslint v9, enable unicorn, ... * use compat plugin only when browserslist is present in package.json * ignore nuxt pages filename casing with params * enabled 2 shopify typescript rules --- package.json | 10 +- packages/eslint-config/github.js | 4 +- packages/eslint-config/index.d.ts | 4 +- packages/eslint-config/index.js | 110 +- packages/eslint-config/package.json | 18 +- packages/prettier-config/package.json | 2 +- pnpm-lock.yaml | 2113 ++++++++++++------------- 7 files changed, 1087 insertions(+), 1174 deletions(-) diff --git a/package.json b/package.json index f220793..4aa9dc3 100644 --- a/package.json +++ b/package.json @@ -7,20 +7,18 @@ "author": "Louis Haftmann", "license": "MIT", "scripts": { - "lint": "pnpm -r run stub && eslint .", + "lint": "eslint .", "test": "pnpm -r run test", "build": "pnpm -r run build", - "prepare": "pnpm -r run stub", "release": "bumpp -r && pnpm run publish", "publish": "pnpm -r publish --filter=!@louishaftmann/config-monorepo --no-git-checks --access public" }, "devDependencies": { "@louishaftmann/eslint-config": "workspace:*", "@louishaftmann/prettier-config": "workspace:*", - "bumpp": "^9.4.1", - "eslint": "^8.57.0", - "rimraf": "^5.0.7", - "typescript": "^5.4.5" + "bumpp": "^9.4.2", + "eslint": "^9.8.0", + "typescript": "^5.5.4" }, "changelogithub": { "extends": "gh:falcondev-it/configs/changelogithub" diff --git a/packages/eslint-config/github.js b/packages/eslint-config/github.js index 2cf187d..32de570 100644 --- a/packages/eslint-config/github.js +++ b/packages/eslint-config/github.js @@ -1,3 +1,4 @@ +import { fixupPluginRules } from '@eslint/compat' import { FlatCompat } from '@eslint/eslintrc' const compat = new FlatCompat() @@ -21,13 +22,14 @@ const github = compat.extends('plugin:github/recommended').map((configItem, inde delete configItem.plugins['eslint-comments'] delete configItem.plugins.import delete configItem.plugins.prettier + configItem.plugins.github = fixupPluginRules(configItem.plugins.github) } configItem.name = `github/${index}` return configItem }) -/** @type {import('eslint').Linter.FlatConfig[]} */ +/** @type {import('eslint').Linter.Config[]} */ export default [ ...github, { diff --git a/packages/eslint-config/index.d.ts b/packages/eslint-config/index.d.ts index 7a5ea3d..062d28d 100644 --- a/packages/eslint-config/index.d.ts +++ b/packages/eslint-config/index.d.ts @@ -1,11 +1,9 @@ -import type { TypedFlatConfigItem } from '@antfu/eslint-config' import type antfu from '@antfu/eslint-config' declare function eslintConfig(config: { nuxt: boolean unicorn?: boolean - tsconfigPath?: string[] - /** @deprecated */ configs?: TypedFlatConfigItem[] + tsconfigPath?: string }): ReturnType export { eslintConfig, eslintConfig as default } diff --git a/packages/eslint-config/index.js b/packages/eslint-config/index.js index 5838864..a402cce 100644 --- a/packages/eslint-config/index.js +++ b/packages/eslint-config/index.js @@ -1,18 +1,17 @@ import antfu from '@antfu/eslint-config' -import { FlatCompat } from '@eslint/eslintrc' +import shopifyEslintPlugin from '@shopify/eslint-plugin' import eslintConfigPrettier from 'eslint-config-prettier' import eslintPluginCompat from 'eslint-plugin-compat' import eslintPluginUnicorn from 'eslint-plugin-unicorn' +import { loadPackageJSON } from 'local-pkg' import github from './github.js' import nuxtRules from './nuxt.js' delete eslintConfigPrettier.rules['vue/html-self-closing'] -const compat = new FlatCompat() - /** @type {import('./index.d.ts').eslintConfig} */ -export function eslintConfig({ nuxt = false, tsconfigPath, unicorn = false, configs }) { +export function eslintConfig({ nuxt = false, tsconfigPath }) { return antfu({ stylistic: false, @@ -23,8 +22,8 @@ export function eslintConfig({ nuxt = false, tsconfigPath, unicorn = false, conf vue: { sfcBlocks: { blocks: { - styles: false - } + styles: false, + }, }, overrides: { // force