Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
Overhaul linting + formatting approach
Browse files Browse the repository at this point in the history
The standard linter didn't play nice with Prettier, so that we had
standard undo certain formatting applied by Prettier. Thus we couldn't
rely on the Prettier extension in say VS Code to apply formatting right
away upon saving: an extra call in the CLI was necessary to apply the
final formatting..

This change simplifies the approach: we're using Prettier for formatting
with an externalized config so that editors can pick it up, and eslint
for linting, and the two won't interfere.

This also allows us to add explicit steps for linting and formatting
checks in the CI pipeline.
  • Loading branch information
carhartl committed Jun 23, 2023
1 parent 2ed1301 commit ea995bd
Show file tree
Hide file tree
Showing 11 changed files with 334 additions and 2,233 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
18 changes: 12 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"extends": "standard",
"rules": {
"no-undef": "off",
"no-unused-vars": "off",
"space-before-function-paren": "error"
"env": {
"browser": true,
"es2021": true
},
"plugins": ["html", "markdown"]
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {}
}
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
workflow_dispatch:

jobs:
test:
build:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -37,14 +37,17 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Check formatting
run: npm run format:check
- name: Lint
run: npm run lint
run: npm run lint:check
- name: Run unit tests
run: npm test

coverage:
needs: [test]
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -62,8 +65,9 @@ jobs:
coverageCommand: npm run coverage

e2e:
needs: [test]
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist
coverage
dist
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TypeScript Cookie [![CI Status](https://github.com/carhartl/typescript-cookie/actions/workflows/ci.yml/badge.svg)](https://github.com/carhartl/typescript-cookie/actions/workflows/ci.yml) [![TypeScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Maintainability](https://api.codeclimate.com/v1/badges/d87f5ff1ca1041f8723a/maintainability)](https://codeclimate.com/github/carhartl/typescript-cookie/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/d87f5ff1ca1041f8723a/test_coverage)](https://codeclimate.com/github/carhartl/typescript-cookie/test_coverage) [![npm](https://img.shields.io/github/package-json/v/carhartl/typescript-cookie)](https://www.npmjs.com/package/typescript-cookie)
# TypeScript Cookie [![CI Status](https://github.com/carhartl/typescript-cookie/actions/workflows/ci.yml/badge.svg)](https://github.com/carhartl/typescript-cookie/actions/workflows/ci.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/d87f5ff1ca1041f8723a/maintainability)](https://codeclimate.com/github/carhartl/typescript-cookie/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/d87f5ff1ca1041f8723a/test_coverage)](https://codeclimate.com/github/carhartl/typescript-cookie/test_coverage) [![npm](https://img.shields.io/github/package-json/v/carhartl/typescript-cookie)](https://www.npmjs.com/package/typescript-cookie)

A simple, lightweight TypeScript API for handling cookies.

Expand Down

0 comments on commit ea995bd

Please sign in to comment.