-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
9,570 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const config = { | ||
extends: ['@commitlint/config-conventional'], | ||
rules: { | ||
'footer-max-line-length': [1, 'always', 72], | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[*] | ||
indent_style = tab | ||
tab_width = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: daily | ||
time: "00:00" | ||
timezone: "Etc/UTC" | ||
|
||
- package-ecosystem: npm | ||
directory: / | ||
schedule: | ||
interval: daily | ||
time: "00:00" | ||
timezone: "Etc/UTC" | ||
rebase-strategy: auto | ||
versioning-strategy: increase | ||
commit-message: | ||
prefix: "fix(deps)" | ||
prefix-development: "chore(deps)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: "CI" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
name: "Lint" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: 'Enable corepack' | ||
run: corepack enable | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
cache: 'yarn' | ||
|
||
- name: "Install dependencies" | ||
run: yarn install --immutable | ||
|
||
- name: "Build" | ||
run: yarn build | ||
|
||
- name: "Lint" | ||
run: yarn lint -f ./dist/index.js | ||
|
||
build: | ||
name: "Build" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: 'Enable corepack' | ||
run: corepack enable | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
cache: 'yarn' | ||
|
||
- name: "Install dependencies" | ||
run: yarn install --immutable | ||
|
||
- name: "Build" | ||
run: yarn build | ||
|
||
dependabot-merge: | ||
name: "Dependabot automerge" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
needs: [ "build", "lint" ] | ||
if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' | ||
steps: | ||
- uses: fastify/github-action-merge-dependabot@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
semantic-release: | ||
name: "Release" | ||
runs-on: ubuntu-latest | ||
needs: [ "build", "lint" ] | ||
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | ||
outputs: | ||
new-release-published: ${{ steps.release.outputs.new-release-published }} | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
id-token: write | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: "master" | ||
- name: 'Enable corepack' | ||
run: corepack enable | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
cache: 'yarn' | ||
|
||
- name: Install dependencies | ||
run: yarn install --immutable | ||
|
||
- name: "disable postinstall" | ||
run: yarn pinst --disable | ||
|
||
- name: "Build" | ||
run: yarn build | ||
|
||
- name: "Release" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: yarn semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.idea | ||
.vscode | ||
node_modules | ||
dist | ||
coverage | ||
|
||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if [ "$CI" = "true" ] | ||
then | ||
# disable commitlint for CI environments | ||
exit 0 | ||
else | ||
yarn commitlint --edit | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
yarn lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"*.{js,ts,json,yml}": "yarn lint:fix", | ||
"*.md": "yarn lint:fix" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!/dist/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import ver0Cfg from '@ver0/eslint-config/.prettierrc.js'; | ||
|
||
/** | ||
* @type {import("prettier").Config} | ||
*/ | ||
export default { | ||
...ver0Cfg, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"branches": [ | ||
"master" | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/npm", | ||
"@semantic-release/github" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<div align="center"> | ||
|
||
# ESLint Formatter for GitHub Actions | ||
|
||
[](https://www.npmjs.com/package/@react-hookz/eslint-formatter-gha) | ||
[](https://www.npmjs.com/package/@react-hookz/eslint-formatter-gha) | ||
[](https://www.npmjs.com/package/@react-hookz/eslint-formatter-gha) | ||
[](https://github.com/react-hookz/eslint-formatter-gha/actions) | ||
[](https://www.npmjs.com/package/@react-hookz/eslint-formatter-gha) | ||
|
||
</div> | ||
|
||
--- | ||
|
||
Custom formatter for ESLint that generates GitHub Actions annotations. | ||
|
||
## Install | ||
|
||
This one is pretty simple, everyone knows what to do: | ||
|
||
```shell | ||
npm i --save-dev @react-hookz/eslint-formatter-gha | ||
# or | ||
yarn add -D @react-hookz/eslint-formatter-gha | ||
``` | ||
|
||
## Usage | ||
|
||
```shell | ||
eslint -f @react-hookz/gha | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {buildConfig} from '@ver0/eslint-config'; | ||
|
||
/** @typedef {import('eslint').Linter} Linter */ | ||
|
||
/** @type {Linter.Config[]} */ | ||
const cfg = [ | ||
{ignores: ['dist/**/*']}, | ||
...buildConfig({ | ||
globals: 'node', | ||
react: true, | ||
vitest: true, | ||
}), | ||
{ | ||
files: ['README.md'], | ||
language: 'markdown/gfm', | ||
}, | ||
]; | ||
|
||
export default cfg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"name": "@ver0/eslint-formatter-gha", | ||
"description": "ESLint formatter for Github Actions", | ||
"version": "1.0.0", | ||
"keywords": [ | ||
"eslint", | ||
"formatter", | ||
"eslint-formatter", | ||
"guthub-actions" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ver0-project/eslint-formatter-gha" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ver0-project/eslint-formatter-gha/issues" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"license": "MIT", | ||
"author": "Anton Zinovyev <[email protected]>", | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"postinstall": "husky", | ||
"build": "yarn build:clean && yarn tsc -p tsconfig.build.json", | ||
"build:clean": "rimraf dist", | ||
"lint": "eslint", | ||
"lint:fix": "eslint --fix" | ||
}, | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"@actions/core": "^1.11.1" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^19.7.1", | ||
"@commitlint/config-conventional": "^19.7.1", | ||
"@types/eslint": "^9.6.1", | ||
"@types/node": "^22.13.1", | ||
"@ver0/eslint-config": "^1.1.1", | ||
"eslint": "^9.20.0", | ||
"husky": "^9.1.7", | ||
"lint-staged": "^15.4.3", | ||
"pinst": "^3.0.0", | ||
"rimraf": "^6.0.1", | ||
"semantic-release": "^24.2.1", | ||
"typescript": "^5.7.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {endGroup, error, notice, startGroup, warning} from '@actions/core'; | ||
import type {ESLint} from 'eslint'; | ||
|
||
const severityActor = [notice, warning, error]; | ||
|
||
const GHAFormatter: ESLint.Formatter['format'] = (results) => { | ||
startGroup('Lint Annotations'); | ||
|
||
for (const result of results) { | ||
for (const message of result.messages) { | ||
const actor = severityActor[message.severity]; | ||
if (!actor) { | ||
warning(`Unknown eslint severity: ${message.severity}`); | ||
|
||
continue; | ||
} | ||
|
||
actor(`${message.message} (${message.ruleId})`, { | ||
file: result.filePath, | ||
startLine: message.line, | ||
endLine: message.endLine, | ||
startColumn: message.column, | ||
endColumn: message.endColumn, | ||
}); | ||
} | ||
} | ||
|
||
endGroup(); | ||
|
||
return ''; | ||
}; | ||
|
||
export default GHAFormatter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"outDir": "./dist" | ||
}, | ||
"include": [ | ||
"src" | ||
], | ||
"exclude": [ | ||
"src/**/*.test.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"strict": true, | ||
"strictNullChecks": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"skipLibCheck": true | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"dist", | ||
".yarn", | ||
".pnp.cjs", | ||
".pnp.loader.mjs" | ||
] | ||
} |
Oops, something went wrong.