Skip to content

Commit

Permalink
chore(deps): update devdependency eslint to v9 (nuxt-modules#178)
Browse files Browse the repository at this point in the history
* chore(deps): update devdependency eslint to v9

* up

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Farnabaz <[email protected]>
  • Loading branch information
renovate[bot] and farnabaz authored Apr 23, 2024
1 parent bb715b4 commit 8c77ea5
Show file tree
Hide file tree
Showing 73 changed files with 582 additions and 522 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/scripts/bump-edge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { execSync } from 'node:child_process'
import { inc } from 'semver'
import { determineBumpType, loadWorkspace } from './utils'

async function main () {
async function main() {
const workspace = await loadWorkspace(process.cwd())

const commit = execSync('git rev-parse --short HEAD').toString('utf-8').trim().slice(0, 8)
Expand Down
24 changes: 15 additions & 9 deletions .github/scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@ import { execaSync } from 'execa'
import { determineSemverChange, getGitDiff, loadChangelogConfig, parseCommits } from 'changelogen'

export interface Dep {
name: string,
range: string,
name: string
range: string
type: string
}

type ThenArg<T> = T extends PromiseLike<infer U> ? U : T
export type Package = ThenArg<ReturnType<typeof loadPackage>>

export async function loadPackage (dir: string) {
export async function loadPackage(dir: string) {
const pkgPath = resolve(dir, 'package.json')
const data = JSON.parse(await fsp.readFile(pkgPath, 'utf-8').catch(() => '{}'))
const save = () => fsp.writeFile(pkgPath, JSON.stringify(data, null, 2) + '\n')

const updateDeps = (reviver: (dep: Dep) => Dep | void) => {
for (const type of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
if (!data[type]) { continue }
if (!data[type]) {
continue
}
for (const e of Object.entries(data[type])) {
const dep: Dep = { name: e[0], range: e[1] as string, type }
delete data[type][dep.name]
Expand All @@ -39,15 +41,17 @@ export async function loadPackage (dir: string) {
}
}

export async function loadWorkspace (dir: string) {
export async function loadWorkspace(dir: string) {
const workspacePkg = await loadPackage(dir)
const pkgDirs = (await globby(['packages/*'], { onlyDirectories: true })).sort()

const packages: Package[] = []

for (const pkgDir of pkgDirs) {
const pkg = await loadPackage(pkgDir)
if (!pkg.data.name) { continue }
if (!pkg.data.name) {
continue
}
packages.push(pkg)
}

Expand All @@ -73,7 +77,9 @@ export async function loadWorkspace (dir: string) {

const setVersion = (name: string, newVersion: string, opts: { updateDeps?: boolean } = {}) => {
find(name).data.version = newVersion
if (!opts.updateDeps) { return }
if (!opts.updateDeps) {
return
}

for (const pkg of packages) {
pkg.updateDeps((dep) => {
Expand All @@ -97,7 +103,7 @@ export async function loadWorkspace (dir: string) {
}
}

export async function determineBumpType () {
export async function determineBumpType() {
const config = await loadChangelogConfig(process.cwd())
const commits = await getLatestCommits()

Expand All @@ -106,7 +112,7 @@ export async function determineBumpType () {
return bumpType === 'major' ? 'minor' : bumpType
}

export async function getLatestCommits () {
export async function getLatestCommits() {
const config = await loadChangelogConfig(process.cwd())

let latestRef
Expand Down
4 changes: 2 additions & 2 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fs from 'node:fs'
import { defineBuildConfig } from 'unbuild'
import fs from 'fs'

export default defineBuildConfig({
entries: [
'src/config.ts',
'src/config.ts'
],
hooks: {
'rollup:done': () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ module.exports = {
'vue/max-attributes-per-line': 'off',
'vue/multi-word-component-names': 'off'
}
}
}
2 changes: 1 addition & 1 deletion docs/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ export default defineAppConfig({

titleTemplate: 'Nuxt MDC'
}
})
})
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@nuxt/eslint-config": "^0.3.9",
"@nuxtjs/plausible": "^1.0.0",
"@types/node": "^20.12.7",
"eslint": "^8.57.0",
"eslint": "^9.1.1",
"nuxt": "^3.11.2"
}
}
26 changes: 26 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'

export default createConfigForNuxt({
features: {
tooling: true,
stylistic: {
quoteProps: 'as-needed',
commaDangle: 'never',
braceStyle: '1tbs'
}
},
dirs: {
src: [
'./playground',
'./docs'
]
}
}).overrideRules({
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
'vue/max-attributes-per-line': 'off',
'vue/no-v-html': 'off',
'vue/multi-word-component-names': 'off'
})
4 changes: 2 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fileURLToPath } from 'url'
import { fileURLToPath } from 'node:url'

export default defineNuxtConfig({
typescript: {
Expand All @@ -7,7 +7,7 @@ export default defineNuxtConfig({
paths: {
'@nuxtjs/mdc/config': [
fileURLToPath(new URL('./src/config.ts', import.meta.url))
],
]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"@types/mdurl": "^1.0.5",
"@types/node": "^20.12.7",
"changelogen": "^0.5.5",
"eslint": "^8.57.0",
"eslint": "^9.1.1",
"nuxt": "^3.11.2",
"rehype": "^13.0.1",
"release-it": "^17.2.0",
Expand Down
3 changes: 1 addition & 2 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ export default defineNuxtConfig({
'@nuxt/ui',
'../src/module'
],
// @ts-ignore
mdc: {
highlight: {
theme: {
default: 'vitesse-light',
dark: 'material-theme-palenight',
dark: 'material-theme-palenight'
},
preload: [
'sql'
Expand Down
Loading

0 comments on commit 8c77ea5

Please sign in to comment.