Skip to content

Commit

Permalink
fix(deps): update commitlint monorepo to v17 (major) (#207)
Browse files Browse the repository at this point in the history
* fix(deps): update commitlint monorepo to v17

* chore: update linter file

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Julien Karst <[email protected]>
  • Loading branch information
renovate[bot] and JulienKode authored Jul 20, 2022
1 parent 77313ff commit acd20e3
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 126 deletions.
11 changes: 6 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/es6"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
Expand All @@ -16,13 +16,14 @@
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-ignore": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
Expand Down Expand Up @@ -50,4 +51,4 @@
"es6": true,
"jest/globals": true
}
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"author": "Julien Karst",
"license": "MIT",
"devDependencies": {
"@commitlint/types": "16.2.1",
"@commitlint/types": "17.0.0",
"@types/jest": "27.5.2",
"@types/node": "16.11.45",
"@typescript-eslint/parser": "5.30.6",
Expand All @@ -45,8 +45,8 @@
"dependencies": {
"@actions/core": "1.9.0",
"@actions/github": "5.0.3",
"@commitlint/lint": "16.2.4",
"@commitlint/load": "16.2.4"
"@commitlint/lint": "17.0.3",
"@commitlint/load": "17.0.3"
},
"resolutions": {
"import-fresh": "JulienKode/import-fresh#fix/issue-when-there-no-parent-module"
Expand Down
13 changes: 8 additions & 5 deletions src/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {
import load from '@commitlint/load'
import lint from '@commitlint/lint'

function selectParserOpts(parserPreset: ParserPreset) {
function selectParserOpts(parserPreset: ParserPreset): object | null {
if (typeof parserPreset !== 'object') {
return undefined
return null
}

if (typeof parserPreset.parserOpts !== 'object') {
return undefined
return null
}

return parserPreset.parserOpts
Expand Down Expand Up @@ -42,7 +42,10 @@ function getLintOptions(configuration: QualifiedConfig): LintOptions {
return opts
}

export async function lintPullRequest(title: string, configPath: string) {
export async function lintPullRequest(
title: string,
configPath: string
): Promise<void> {
const configuration = await load({}, {file: configPath, cwd: process.cwd()})

const options = getLintOptions(configuration)
Expand All @@ -51,7 +54,7 @@ export async function lintPullRequest(title: string, configPath: string) {

if (result.valid) return
const errorMessage = result.errors
.map(({message, name}: any) => `${name}:${message}`)
.map(({message, name}) => `${name}:${message}`)
.join('\n')
throw new Error(errorMessage)
}
Loading

0 comments on commit acd20e3

Please sign in to comment.