Skip to content

Commit

Permalink
Improve dev setup (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
kachkaev authored Nov 5, 2022
1 parent 63a4cf5 commit dc7ac66
Show file tree
Hide file tree
Showing 13 changed files with 133 additions and 128 deletions.
31 changes: 22 additions & 9 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
## extensions
*.*
LICENSE
#####################
## Specific to ESLint
#####################

## Ignore all files (but still allow sub-folder scanning)
*
!*/

## Allow certain file types
!*.cjs
!*.js
!*.json
!*.mjs
!*.ts

!/.github/
/fixtures/
#########################
## Shared between linters
#########################

fixtures

########################
## Same as in .gitignore
########################

## same as in .gitignore
node_modules
*.log
.DS_Store
*.log
cache
coverage
dist
junit.xml
node_modules
7 changes: 4 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/** @type{import("eslint").Linter.Config} */
module.exports = {
extends: ["@kachkaev/eslint-config-base"],
reportUnusedDisableDirectives: true,
rules: {
/* eslint-disable @typescript-eslint/naming-convention */
"unicorn/prefer-json-parse-buffer": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-module": "off", // Can be enabled after switching to ESM
"unicorn/prefer-node-protocol": "off", // Can be enabled after switching to ESM or dropping Node.js 14
/* eslint-enable @typescript-eslint/naming-convention */
},
};
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ jobs:
- name: Run unit tests
run: yarn test
env:
REPORT_TEST_RESULTS_AND_COVERAGE: ${{ matrix.os == 'ubuntu-22.04' && matrix.node == 18 }}
TEST_COVERAGE: ${{ matrix.os == 'ubuntu-22.04' && matrix.node == 18 }}

- name: Report code coverage to codecov.io
uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-22.04' && matrix.node == 18
with:
files: ./coverage/cobertura-coverage.xml
files: coverage/lcov.info
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules
*.log
.DS_Store
*.log
cache
coverage
dist
junit.xml
node_modules
4 changes: 1 addition & 3 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"extends": "./node_modules/@kachkaev/markdownlint-config/index.json",
"first-line-heading": false,
"no-inline-html": false
"extends": "@kachkaev/markdownlint-config"
}
29 changes: 20 additions & 9 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
## extensions
*.*
LICENSE
###########################
## Specific to Markdownlint
###########################

## Ignore all files (but still allow sub-folder scanning)
*
!*/

## Allow certain file types
!*.md

!/.github/
/fixtures/
#########################
## Shared between linters
#########################

fixtures

########################
## Same as in .gitignore
########################

## same as in .gitignore
node_modules
*.log
.DS_Store
*.log
cache
coverage
dist
junit.xml
node_modules
31 changes: 22 additions & 9 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
## extensions
*.*
LICENSE
#######################
## Specific to Prettier
#######################

## Ignore all files (but still allow sub-folder scanning)
*
!*/

## Allow certain file types
!*.cjs
!*.js
!*.json
!*.md
!*.mjs
!*.ts
!*.yml

!/.github/
/fixtures/
#########################
## Shared between linters
#########################

fixtures

########################
## Same as in .gitignore
########################

## same as in .gitignore
node_modules
*.log
.DS_Store
*.log
cache
coverage
dist
junit.xml
node_modules
11 changes: 0 additions & 11 deletions jest.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-disable import/no-anonymous-default-export */
/** @type {import("jest").Config} */
export default {
collectCoverage: !!process.env.TEST_COVERAGE,
collectCoverageFrom: ["dist/**/*.js", "!dist/**/*.test.js"],
testRegex: ".test.js$",
};
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
"license": "BSD-3-Clause",
"main": "dist",
"scripts": {
"build": "tsc --project .",
"build": "tsc",
"clean": "rimraf cache coverage dist",
"fix": "npm-run-all --continue-on-error fix:*",
"fix:eslint": "eslint --fix \"**/*\"",
"fix:markdownlint": "markdownlint --fix \"**/*\"",
"fix:eslint": "eslint --fix .",
"fix:markdownlint": "markdownlint --fix .",
"fix:prettier": "prettier --write .",
"fix:yarn-deduplicate": "yarn install && yarn-deduplicate --strategy=fewer && yarn install",
"lint": "npm-run-all --continue-on-error lint:*",
"lint:markdownlint": "markdownlint \"**/*\"",
"lint:markdownlint": "markdownlint .",
"lint:prettier": "prettier --check .",
"lint:tsc": "tsc --project .",
"lint:eslint": "eslint \"**/*\" --report-unused-disable-directives",
"lint:tsc": "tsc --noEmit",
"lint:eslint": "eslint --report-unused-disable-directives .",
"lint:yarn-deduplicate": "yarn-deduplicate --fail --list --strategy=fewer",
"prepare": "husky install",
"prepublishOnly": "yarn lint && yarn test",
"test": "yarn clean && yarn build && jest"
},
"lint-staged": {
"**/*": [
"**": [
"markdownlint --fix",
"prettier --write"
]
Expand All @@ -46,16 +46,15 @@
"temp-dir": "^2.0.0"
},
"devDependencies": {
"@kachkaev/eslint-config-base": "^0.4.3",
"@kachkaev/markdownlint-config": "^0.3.0",
"@kachkaev/eslint-config-base": "^0.5.0",
"@kachkaev/markdownlint-config": "^0.5.0",
"@types/jest": "^29.2.2",
"@types/object-hash": "^2.2.1",
"@types/prettier": "^2.7.1",
"@types/rimraf": "^3.0.2",
"eslint": "^8.26.0",
"husky": "^8.0.1",
"jest": "^29.2.2",
"jest-junit": "^14.0.1",
"lint-staged": "^13.0.3",
"markdownlint-cli": "^0.32.2",
"npm-run-all": "^4.1.5",
Expand Down
3 changes: 2 additions & 1 deletion src/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const print = (path: AstPath) => {
}

/* istanbul ignore next */
default:
default: {
if (process.env.NODE_ENV === "test") {
throw new Error(
`Unknown Elm node: ${JSON.stringify(
Expand All @@ -23,5 +23,6 @@ export const print = (path: AstPath) => {
console.error("Unknown Elm node:", node);

return node.source;
}
}
};
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"inlineSourceMap": true,
"lib": ["ES2019"],
"module": "commonjs",
"checkJs": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
Expand Down
Loading

0 comments on commit dc7ac66

Please sign in to comment.