Skip to content

Commit

Permalink
build: eslint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Sep 28, 2024
1 parent 28b1066 commit 2296aa8
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
!.gitignore
!.github
!.husky
!.prettierrc.yml
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run lint:staged
1 change: 1 addition & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
experimentalTernaries: true
10 changes: 10 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
extends: ["@commitlint/config-conventional"],
rules: {
"type-enum": [
2,
"always",
["build", "chore", "ci", "docs", "feat", "fix", "refactor", "test"],
],
},
};
18 changes: 18 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import globals from "globals";
import js from "@eslint/js";
import ts from "typescript-eslint";
import mocha from "eslint-plugin-mocha";
import prettier from "eslint-plugin-prettier/recommended";

export default [
{
ignores: ["dist/**"],
},
{
languageOptions: { globals: { ...globals.node } },
},
js.configs.recommended,
...ts.configs.recommended,
mocha.configs.flat.recommended,
prettier,
];
34 changes: 26 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,31 @@
"author": "David Worms <david@adaltas.com> (https://www.adaltas.com)",
"contributors": [],
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@eslint/core": "^0.6.0",
"@eslint/js": "^9.11.1",
"@types/eslint__js": "^8.42.3",
"@types/mocha": "^10.0.8",
"@types/node": "^22.7.4",
"@types/should": "^13.0.0",
"@types/wcwidth": "^1.0.2",
"coffeescript": "^2.7.0",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-mocha": "^10.5.0",
"eslint-plugin-prettier": "^5.2.1",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"mocha": "^10.7.3",
"prettier": "^3.3.3",
"rollup": "^4.22.5",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-node-resolve": "^5.0.0",
"should": "^13.2.3",
"standard-version": "^9.5.0",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0"
},
"dependencies": {
"wcwidth": "^1.0.1"
Expand All @@ -34,6 +46,10 @@
"/dist"
],
"license": "BSD-3-Clause",
"lint-staged": {
"*.js": "npm run lint:fix",
"*.md": "prettier -w"
},
"main": "dist/pad.cjs.js",
"mocha": {
"inline-diffs": true,
Expand All @@ -53,12 +69,14 @@
},
"scripts": {
"build": "rollup -c && cp -p lib/index.d.ts dist/pad.d.ts",
"preversion": "grep '## Trunk' CHANGELOG.md && npm test",
"version": "version=`grep '^ \"version\": ' package.json | sed 's/.*\"\\([0-9\\.]*\\)\".*/\\1/'` && sed -i \"s/## Trunk/## Version $version/\" CHANGELOG.md && git add CHANGELOG.md",
"postversion": "git push && git push --tags && npm publish",
"patch": "npm version patch -m 'Bump to version %s'",
"minor": "npm version minor -m 'Bump to version %s'",
"major": "npm version major -m 'Bump to version %s'",
"lint:check": "eslint",
"lint:fix": "eslint --fix",
"lint:staged": "npx lint-staged",
"release": "standard-version",
"release:minor": "standard-version --release-as minor",
"release:patch": "standard-version --release-as patch",
"release:major": "standard-version --release-as major",
"postrelease": "git push --follow-tags origin master",
"test": "mocha test/*.{js,ts}",
"prepare": "husky install"
},
Expand Down

0 comments on commit 2296aa8

Please sign in to comment.