Skip to content

Commit

Permalink
Merge pull request #1 from NullVoxPopuli/prepare-for-plugin-consumers
Browse files Browse the repository at this point in the history
Prepare for plugin consumers
  • Loading branch information
NullVoxPopuli authored Jan 23, 2024
2 parents a827549 + b37e816 commit c51935b
Show file tree
Hide file tree
Showing 18 changed files with 3,045 additions and 207 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

const { configs } = require('@nullvoxpopuli/eslint-configs');

// accommodates: JS, TS, ESM, and CJS
module.exports = configs.node();
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI

on:
push:
branches:
- main
- master
pull_request: {}

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: wyvox/action-setup-pnpm@v3
- name: Lint
run: pnpm lint
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
.eslintcache
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.yaml
*.yml
21 changes: 21 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

module.exports = {
printWidth: 100,
overrides: [
{
// Lol, JavaScript
files: ['*.js', '*.ts', '*.cjs', '.mjs', '.cts', '.mts', '.cts'],
options: {
singleQuote: true,
trailingComma: 'es5',
},
},
{
files: ['*.json'],
options: {
singleQuote: false,
},
},
],
};
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@ Why fix anything, when we can post-process!

## Usage

```bash
### CLI

```bash
npx fix-bad-declaration-output './declarations/**/*.d.ts'
```

### JS

```js
import { fixBadDeclarationOutput } from "fix-bad-declaration-output";

await fixBadDeclarationOutput("./declarations/**/*.d.ts", ["TypeScript#56571", "Glint#628"]);
```

At least one fixer is required to be specified in the second argument.

## Current Fixes

Expand All @@ -23,6 +34,6 @@ TypeScript does not tell you why anything happens, and because, in Ember, we can

### Rewrite imports ending with `.gts`

In modern tooling, extensions are included in the import paths to help with understanding of what files imports are pointing to, as well as help reduce complexity in build tooling.
In modern tooling, extensions are included in the import paths to help with understanding of what files imports are pointing to, as well as help reduce complexity in build tooling.

See [This Glint Issue](https://github.com/typed-ember/glint/issues/628) as well as some relevant discussion in the [Ember Discord](https://discord.com/channels/480462759797063690/568935504288940056/1171838869914779659) for more details on why a fix hasn't landed in Glint (tl;dr: no one knows what to do)
16 changes: 0 additions & 16 deletions fixes/ember.js

This file was deleted.

13 changes: 0 additions & 13 deletions index.js

This file was deleted.

35 changes: 33 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,30 @@
"name": "fix-bad-declaration-output",
"version": "1.0.0",
"type": "module",
"main": "index.js",
"bin": "index.js",
"bin": "src/bin.js",
"module": "./src/index.js",
"exports": {
".": {
"default": "./src/index.js"
}
},
"scripts": {
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "pnpm lint:js:fix && pnpm format:fix",
"lint:package": "publint .",
"lint:js": "eslint . --cache",
"lint:format": "prettier . --check",
"format:fix": "prettier . --write",
"lint:js:fix": "eslint . --fix",
"lint:types": "tsc --noEmit",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "NullVoxPopuli",
"license": "MIT",
"files": [
"src/**"
],
"publishConfig": {
"registry": "https://registry.npmjs.org",
"access": "public"
Expand All @@ -18,5 +34,20 @@
"fs-extra": "^11.2.0",
"globby": "^14.0.0",
"jscodeshift": "^0.15.1"
},
"devDependencies": {
"@nullvoxpopuli/eslint-configs": "^3.2.2",
"@tsconfig/node21": "^21.0.1",
"@tsconfig/strictest": "^2.0.2",
"@types/fs-extra": "^11.0.4",
"@types/jscodeshift": "^0.11.11",
"@types/node": "^20.11.5",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"concurrently": "^8.2.2",
"eslint": "^8.56.0",
"prettier": "^3.2.4",
"publint": "^0.2.7",
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit c51935b

Please sign in to comment.