Skip to content

Commit 4d49c46

Browse files
committed
Initial commit
0 parents  commit 4d49c46

28 files changed

+8018
-0
lines changed

.c8rc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"100": true,
3+
"include": "lib"
4+
}

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 100
10+
trim_trailing_whitespace = true
11+
12+
[COMMIT_EDITMSG]
13+
max_line_length = 72

.github/workflows/ci.yaml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
tags: ['*']
8+
9+
jobs:
10+
eslint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 24
17+
- run: npm ci
18+
- run: npx eslint
19+
20+
pack:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: 24
27+
- run: npm ci
28+
- run: npm pack
29+
- uses: actions/upload-artifact@v4
30+
with:
31+
name: package
32+
path: '*.tgz'
33+
34+
prettier:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: 24
41+
- run: npm ci
42+
- run: npx prettier --check .
43+
44+
remark:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-node@v4
49+
with:
50+
node-version: 24
51+
- run: npm ci
52+
- run: npx remark --frail .
53+
54+
test:
55+
runs-on: ubuntu-latest
56+
strategy:
57+
matrix:
58+
node-version:
59+
- 20
60+
- 22
61+
- 24
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: actions/setup-node@v4
65+
with:
66+
node-version: ${{ matrix.node-version }}
67+
- run: npm ci
68+
- run: npm test
69+
- uses: codecov/codecov-action@v5
70+
if: ${{ matrix.node-version == 24 }}
71+
- uses: codecov/test-results-action@v1
72+
if: ${{ matrix.node-version == 24 }}
73+
74+
release:
75+
runs-on: ubuntu-latest
76+
needs:
77+
- eslint
78+
- test
79+
- pack
80+
- prettier
81+
- remark
82+
if: startsWith(github.ref, 'refs/tags/')
83+
permissions:
84+
id-token: write
85+
steps:
86+
- uses: actions/setup-node@v4
87+
with:
88+
node-version: 24
89+
registry-url: https://registry.npmjs.org
90+
- uses: actions/download-artifact@v4
91+
with: { name: package }
92+
- run: npm publish *.tgz --provenance
93+
env:
94+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
coverage/
2+
dist/
3+
node_modules/
4+
*.log
5+
*.tsbuildinfo
6+
*.tgz

.prettierrc.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
proseWrap: always
2+
semi: false
3+
singleQuote: true
4+
trailingComma: none

.remarkrc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
plugins:
2+
- remark-preset-remcohaszing

LICENSE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# MIT License
2+
3+
Copyright © 2025 Remco Haszing
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6+
associated documentation files (the “Software”), to deal in the Software without restriction,
7+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
8+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all copies or substantial
12+
portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
17+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# eslint-formatter-codeclimate
2+
3+
[![github actions](https://github.com/remcohaszing/eslint-formatter-codeclimate/actions/workflows/ci.yaml/badge.svg)](https://github.com/remcohaszing/eslint-formatter-codeclimate/actions/workflows/ci.yaml)
4+
[![codecov](https://codecov.io/gh/remcohaszing/eslint-formatter-codeclimate/branch/main/graph/badge.svg)](https://codecov.io/gh/remcohaszing/eslint-formatter-codeclimate)
5+
[![npm version](https://img.shields.io/npm/v/eslint-formatter-codeclimate)](https://www.npmjs.com/package/eslint-formatter-codeclimate)
6+
[![npm downloads](https://img.shields.io/npm/dm/eslint-formatter-codeclimate)](https://www.npmjs.com/package/eslint-formatter-codeclimate)
7+
8+
Format [ESLint](https://eslint.org) results as a
9+
[Code Climate](https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md) report.
10+
11+
## Table of Contents
12+
13+
- [Installation](#installation)
14+
- [Usage](#usage)
15+
- [Command Line](#command-line)
16+
- [API](#api)
17+
- [`toCodeClimate(results, rulesMeta, cwd)`](#tocodeclimateresults-rulesmeta-cwd)
18+
- [`formatter()`](#formatter)
19+
- [Compatibility](#compatibility)
20+
- [License](#license)
21+
22+
## Installation
23+
24+
```sh
25+
npm install eslint-formatter-codeclimate
26+
```
27+
28+
## Usage
29+
30+
### Command Line
31+
32+
Using the ESLint CLI:
33+
34+
```sh
35+
eslint --format codeclimate
36+
```
37+
38+
Programmatically using Node.js:
39+
40+
```js
41+
import { ESLint } from 'eslint'
42+
import { toCodeClimate } from 'eslint-formatter-codeclimate'
43+
44+
const cwd = process.cwd()
45+
const eslint = new ESLint({ cwd })
46+
const results = await eslint.lintFiles([])
47+
const rulesMeta = eslint.getRulesMetaForResults(results)
48+
const issues = toCodeClimate(results, rulesMeta, cwd)
49+
50+
console.log(issues)
51+
```
52+
53+
## API
54+
55+
### `toCodeClimate(results, rulesMeta, cwd)`
56+
57+
Convert ESLint messages to CodeClimate issues.
58+
59+
#### Arguments
60+
61+
- `results` (`ESLint.LintResult[]`) — The ESLint report results.
62+
- `rulesMeta` (`Record<string, Rule.RuleMetaData>`) — The ESLint rule meta data.
63+
- `cwd` (`string`) — The current work directory to calculate relative paths against.
64+
65+
#### Returns
66+
67+
The ESLint messages in the form of a GitLab code quality report.
68+
69+
### `formatter()`
70+
71+
The default export is an ESLint formatter which represents ESLint results as a CodeClimate report.
72+
73+
#### Arguments
74+
75+
- `results` (`ESLint.LintResult[]`) — The ESLint report results.
76+
- `data` (`ESLint.LintResultData`) — The ESLint report result data.
77+
78+
#### Returns
79+
80+
The Code Climate report as a string.
81+
82+
## Compatibility
83+
84+
This project is compatible with Node.js 20 or greater.
85+
86+
## License
87+
88+
[MIT](LICENSE.md) © [Remco Haszing](https://github.com/remcohaszing)

eslint.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { define } from '@remcohaszing/eslint'
2+
3+
export default define([
4+
{ ignores: ['fixtures'] },
5+
{
6+
rules: {
7+
camelcase: 'off'
8+
}
9+
}
10+
])

fixtures/duplicates/.gitlab-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
lint:
2+
artifacts:
3+
reports:
4+
codequality: gl-codequality.json

0 commit comments

Comments
 (0)