Skip to content

Commit

Permalink
Add ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed Jul 16, 2023
1 parent 43b9597 commit 7f2aaed
Show file tree
Hide file tree
Showing 6 changed files with 4,286 additions and 558 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root: true
extends:
- remcohaszing
rules:
import/no-extraneous-dependencies: off
11 changes: 11 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ on:
tags: ['*']

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
- run: npx eslint .

pack:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -73,6 +83,7 @@ jobs:
release:
runs-on: ubuntu-latest
needs:
- eslint
- test
- pack
- prettier
Expand Down
9 changes: 7 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { resolve } from 'node:path'
import { CompilerFunction, FrozenProcessor } from 'unified'

// @ts-expect-error https://github.com/prettier/prettier-synchronized/pull/11
import prettier from '@prettier/sync'
import { Options } from 'prettier'
import { type Options } from 'prettier'
import { type CompilerFunction, type FrozenProcessor } from 'unified'

/**
* @param options Options to pass to Prettier.
*/
function unifiedPrettier<Processor extends FrozenProcessor>(
this: Processor,
options?: Options | undefined
Expand All @@ -17,6 +21,7 @@ function unifiedPrettier<Processor extends FrozenProcessor>(
this.Compiler = (tree, file) => {
let content: unknown
if (Compiler.prototype?.compile) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const compiler = new (Compiler as any)(tree, file)
content = compiler.compile()
} else {
Expand Down
Loading

0 comments on commit 7f2aaed

Please sign in to comment.