Skip to content

Commit

Permalink
Merge pull request #15 from route06/issue-14-lint-format
Browse files Browse the repository at this point in the history
Introduce linter and formatter to the project
  • Loading branch information
Rindrics authored Jun 13, 2024
2 parents 986bd03 + c706a78 commit 053e643
Show file tree
Hide file tree
Showing 19 changed files with 813 additions and 66 deletions.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: "🐛 Bug Report"
name: '🐛 Bug Report'
about: Report a reproducible bug or regression.
title: ''
labels: bug
assignees: ''

---

## Current Behavior
Expand All @@ -17,4 +16,4 @@ assignees: ''

## Debug log

<!-- Re-run the command and paste the output here -->
<!-- Re-run the command and paste the output here -->
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ about: Suggest a new feature for this project
title: ''
labels: enhancement
assignees: ''

---

## Feature Request

**Is your feature request related to a problem? Please describe.**

<!-- A clear and concise description of what the problem is. Ex. I have an issue when [...] -->

**Describe the solution you'd like**

<!-- A clear and concise description of what you want to happen. Add any considered drawbacks. -->

**Describe alternatives you've considered**

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

## Are you willing to resolve this issue by submitting a Pull Request?
Expand All @@ -31,4 +33,4 @@ assignees: ''

<!--
👋 Have a great day and thank you for the feature request!
-->
-->
7 changes: 5 additions & 2 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ jobs:
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
run: make install

- name: Lint & format
run: make lint

- name: Run tests
run: pnpm test
run: make test
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pnpm-lock.yaml
CHANGELOG.md
eslint.config.js
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
install:
pnpm install

test:
pnpm test

lint:
pnpm lint

format:
pnpm format
13 changes: 13 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{
ignores: [
'**/dist/**',
'jest.config.cjs',
],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
);
32 changes: 16 additions & 16 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
var esmModules = [
"chalk",
"ora",
"cli-cursor",
"restore-cursor",
"log-symbols",
"is-unicode-supported",
"strip-ansi",
"ansi-regex",
"is-interactive",
"stdin-discarder",
'chalk',
'ora',
'cli-cursor',
'restore-cursor',
'log-symbols',
'is-unicode-supported',
'strip-ansi',
'ansi-regex',
'is-interactive',
'stdin-discarder',
];

module.exports = {
preset: "ts-jest/presets/js-with-babel",
testEnvironment: "node",
preset: 'ts-jest/presets/js-with-babel',
testEnvironment: 'node',
transform: {
"^.+\\.[tj]sx?$": "babel-jest",
'^.+\\.[tj]sx?$': 'babel-jest',
},
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transformIgnorePatterns: [
`node_modules/(?!(?:.pnpm/)?(${esmModules.join('|')}))`,
`node_modules/(?!(?:.pnpm/)?(${esmModules.join('|')}))`,
],
testMatch: ["**/?(*.)+(test).[tj]s?(x)"],
testMatch: ['**/?(*.)+(test).[tj]s?(x)'],
};
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
},
"scripts": {
"build": "tsup",
"format": "prettier --write .",
"format-check": "prettier --check .",
"lint": "eslint . && pnpm format-check",
"dev": "tsup --watch",
"prebuild": "run-s clean",
"predev": "run-s clean",
Expand Down Expand Up @@ -62,15 +65,22 @@
"@babel/core": "^7.24.6",
"@babel/preset-env": "^7.24.6",
"@babel/preset-typescript": "^7.24.6",
"@eslint/js": "^9.4.0",
"@types/eslint__js": "^8.42.3",
"@types/jest": "^29.5.12",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"babel-jest": "^29.7.0",
"eslint": "^9.4.0",
"jest": "^29.7.0",
"js-with-babel": "link:ts-jest/presets/js-with-babel",
"npm-run-all": "^4.1.5",
"prettier": "3.2.5",
"ts-jest": "^29.1.4",
"ts-node": "^10.9.1",
"tsup": "^6.5.0",
"typescript": "^4.9.4"
"typescript": "^4.9.5",
"typescript-eslint": "^7.11.0"
}
}
Loading

0 comments on commit 053e643

Please sign in to comment.