Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
chore: migrate to @antfu/eslint-config v2
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSnow committed Apr 2, 2024
1 parent a631f41 commit a3f3d10
Show file tree
Hide file tree
Showing 10 changed files with 900 additions and 315 deletions.
44 changes: 43 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
{
"editor.acceptSuggestionOnEnter": "on"
"editor.acceptSuggestionOnEnter": "on",
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,

// Disable the default formatter, use eslint instead
"prettier.enable": true,
"editor.formatOnSave": true,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always",
"source.organizeImports": "never"
},

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"astro"
]
}
11 changes: 11 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import antfu from '@antfu/eslint-config'

export default antfu({
stylistic: false,
vue: true,
rules: {
'node/prefer-global/process': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/html-self-closing': 'off',
},
})
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"vue3-lazy-hydration": "^1.2.1"
},
"devDependencies": {
"@antfu/eslint-config-vue": "0.42.1",
"@antfu/eslint-config": "2.11.6",
"@moonrepo/cli": "1.22.8",
"@nuxt/image": "1.0.0-rc.1",
"@nuxtjs/tailwindcss": "6.8.0",
Expand All @@ -76,6 +76,7 @@
"@vitejs/plugin-vue": "4.5.2",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-format": "^0.1.0",
"eslint-plugin-prettier": "5.1.3",
"fs-extra": "11.2.0",
"globby": "14.0.1",
Expand All @@ -88,10 +89,10 @@
"vitest": "0.34.6"
},
"resolutions": {
"graphql": "16.8.1",
"nuxt": "3.6.5",
"@nuxt/kit": "3.6.5",
"@nuxt/schema": "3.6.5"
"@nuxt/schema": "3.6.5",
"graphql": "16.8.1",
"nuxt": "3.6.5"
},
"msw": {
"workerDirectory": "public"
Expand Down
8 changes: 4 additions & 4 deletions packages/karbon/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ tasks:
platform: node
inputs:
- tsup.config.ts
- 'dist/helper.mjs'
- dist/helper.mjs
outputs:
- 'dist/helper.mjs'
- dist/helper.mjs
deps:
- dev-prepare
- build-module
Expand All @@ -64,9 +64,9 @@ tasks:
platform: node
inputs:
- tsup.config.ts
- 'dist/module.mjs'
- dist/module.mjs
outputs:
- 'dist/module.mjs'
- dist/module.mjs
deps:
- dev-prepare
- build-module
Expand Down
1 change: 0 additions & 1 deletion packages/karbon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
"zod-validation-error": "^3.0.3"
},
"devDependencies": {
"@antfu/eslint-config-vue": "0.42.1",
"@nuxt/eslint-config": "0.2.0",
"@nuxt/kit": "3.6.5",
"@nuxt/module-builder": "0.5.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/karbon/src/cli/karbon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ async function testBuild() {

if (packageManager === 'yarn') {
await configYarn(path.resolve(tempPath, './.yarnrc.yml'))
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
// eslint-disable-next-line ts/no-require-imports, ts/no-var-requires
const packageJson = require(path.resolve(tempPath, './package.json')) // skipcq: JS-0359
const version = packageJson?.packageManager?.split?.('@')?.[1] || 'berry' // skipcq: JS-W1043

Expand Down
3 changes: 1 addition & 2 deletions packages/karbon/src/runtime/api/siteTemplate.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import type { Buffer } from 'node:buffer'
import { gql } from '@apollo/client/core/index.js'
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache, Observable, gql } from '@apollo/client/core/index.js'
import invariant from 'tiny-invariant'
import fetch from 'node-fetch-native'
import consola from 'consola'
import type { ZodError } from 'zod'
import { z } from 'zod'
import { fromZodError } from 'zod-validation-error'
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache, Observable } from '@apollo/client/core/index.js'
import { createStoripressBaseClient } from '../composables/storipress-base-client'

export enum TemplateType {
Expand Down
2 changes: 1 addition & 1 deletion packages/karbon/src/runtime/server/plugins/hook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { clientHooks } from '@storipress/karbon/internal'
import { type _karbonClientHooks } from '../../composables/storipress-base-client'
import type { _karbonClientHooks } from '../../composables/storipress-base-client'
import { defineNitroPlugin } from '#imports'

const hooks: typeof _karbonClientHooks = clientHooks
Expand Down
1 change: 0 additions & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"vue3-lazy-hydration": "^1.2.1"
},
"devDependencies": {
"@antfu/eslint-config-vue": "0.42.1",
"@nuxt/devtools": "0.8.0",
"@nuxt/image": "1.0.0-rc.1",
"@nuxtjs/tailwindcss": "6.8.0",
Expand Down
Loading

0 comments on commit a3f3d10

Please sign in to comment.