Skip to content

Commit

Permalink
chore: update eslint dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jpntex committed Nov 2, 2023
1 parent 5b4bd12 commit a8cefe0
Show file tree
Hide file tree
Showing 7 changed files with 652 additions and 413 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "indielayer/eslint-config" }],
"changelog": ["../.scripts/changelog.js", { "repo": "indielayer/eslint-config" }],
"commit": false,
"fixed": [],
"linked": [],
Expand Down
6 changes: 6 additions & 0 deletions .changeset/kind-grapes-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@indielayer/eslint-config-vue": patch
"@indielayer/eslint-config": patch
---

update eslint dependencies
135 changes: 135 additions & 0 deletions .scripts/changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
const { getInfo, getInfoFromPullRequest } = require('@changesets/get-github-info')

module.exports = {
getDependencyReleaseLine: async (
changesets,
dependenciesUpdated,
options
) => {
if (!options.repo) {
throw new Error(
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]'
);
}

if (dependenciesUpdated.length === 0) return ''

const changesetLink = `- Updated dependencies [${(
await Promise.all(
changesets.map(async (cs) => {
if (cs.commit) {
const { links } = await getInfo({
repo: options.repo,
commit: cs.commit,
})
return links.commit
}
})
)
)
.filter((_) => _)
.join(', ')}]:`

const updatedDepenenciesList = dependenciesUpdated.map(
(dependency) => ` - ${dependency.name}@${dependency.newVersion}`
)

return [changesetLink, ...updatedDepenenciesList].join('\n')
},
getReleaseLine: async (changeset, type, options) => {
if (!options || !options.repo) {
throw new Error(
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]'
);
}

let prFromSummary
let commitFromSummary
const usersFromSummary = []

const replacedChangelog = changeset.summary
.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr) => {
const num = Number(pr)

if (!isNaN(num)) prFromSummary = num

return ''
})
.replace(/^\s*commit:\s*([^\s]+)/im, (_, commit) => {
commitFromSummary = commit

return ''
})
.replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, (_, user) => {
usersFromSummary.push(user)

return ''
})
.trim()

const [firstLine, ...futureLines] = replacedChangelog
.split('\n')
.map((l) => l.trimRight())

const links = await (async () => {
if (prFromSummary !== undefined) {
let { links } = await getInfoFromPullRequest({
repo: options.repo,
pull: prFromSummary,
})

if (commitFromSummary) {
links = {
...links,
commit: `[\`${commitFromSummary}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`,
}
}

return links
}
const commitToFetchFrom = commitFromSummary || changeset.commit

if (commitToFetchFrom) {
const { links } = await getInfo({
repo: options.repo,
commit: commitToFetchFrom,
})

return links
}

return {
commit: null,
pull: null,
user: null,
}
})()

// const users = usersFromSummary.length
// ? usersFromSummary
// .map(
// (userFromSummary) =>
// `[@${userFromSummary}](https://github.com/${userFromSummary})`
// )
// .join(', ')
// : links.user

// const usersStr = users ? ` \[${users}\]` : ''

const suffix = [
links.pull === null ? '' : ` (${links.pull})`,
links.commit === null ? '' : ` (${links.commit})`
].join('')

const firstLineWithPrefix = `- ${firstLine}`

if (futureLines.length === 0) {
return `${firstLineWithPrefix}${suffix}`
}

return `${firstLineWithPrefix}\n${futureLines
.map((l) => ` ${l}`)
.join('\n')}\n ${suffix}`
},
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"devDependencies": {
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"eslint": "^8.43.0"
"eslint": "^8.52.0"
}
}
8 changes: 4 additions & 4 deletions packages/eslint-config-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
"access": "public"
},
"dependencies": {
"@indielayer/eslint-config": "^3.2.0",
"eslint-plugin-vue": "^9.15.1"
"@indielayer/eslint-config": "workspace:^",
"eslint-plugin-vue": "^9.18.1"
},
"devDependencies": {
"eslint": "^8.43.0",
"eslint": "^8.52.0",
"stylelint": "^14.16.1"
},
"peerDependencies": {
"eslint": "^8.43.0"
"eslint": "^8.0.0"
}
}
8 changes: 4 additions & 4 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
"index.js"
],
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"typescript": "^5.0.0"
},
"devDependencies": {
"eslint": "^8.43.0"
"eslint": "^8.52.0"
},
"peerDependencies": {
"eslint": "^8.43.0"
"eslint": "^8.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
Loading

0 comments on commit a8cefe0

Please sign in to comment.