Skip to content

Commit

Permalink
chore: prepare for first publish
Browse files Browse the repository at this point in the history
Tested package with yalc
  • Loading branch information
rickdgeerling committed Jan 12, 2024
1 parent a1a4186 commit 303eb44
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 26 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,31 @@ At Trilon, our goal is to help elevate teams - giving them the push they need to
As part of that, we focus on developing tools that make **your** dev experience easier, enjoyable, and safer.

The official Trilon Eslint Plugin is part of that toolbelt to help your team to thrive, applying best practices for NestJS, curated by our key contributors and core team.

## Installation

> Once this package gets published
```sh
npm install @trilon/eslint-plugin
```

And add these the plugin to your `.eslintrc`:

```js
{
plugins: ['@trilon/eslint-plugin'],
extends: ['plugin:@trilon/recommended'],
}
```

The "recommended" preset contains the rules listed below. If you need custom configuration, please refer to the documentation of the individual linting rules.

## Rules

🚫: Rule is configured to mark invalid code with an **error**
⚠️:: Rule is configured to mark invalid code with a **warning**

| Rule | Description | Recommended |
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------- | ----------- |
| [`@trilon/enforce-close-testing-module`](docs/rules/enforce-close-testing-module.md) | Ensures NestJS testing modules are closed properly after tests | 🚫 |
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "eslint-plugin",
"version": "1.0.0",
"name": "@trilon/eslint-plugin",
"version": "0.0.1",
"description": "Official Trilon Eslint Plugin",
"type": "commonjs",
"main": "index.js",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib/**/*",
Expand All @@ -16,6 +16,7 @@
"yarn": ">=4.0.2"
},
"scripts": {
"prepublish": "tsc",
"tsc": "rimraf ./lib && tsc -p tsconfig.build.json && tsc-alias",
"test": "tsx --import ./tests/global.setup.js --test tests/**/*.spec.ts",
"format": "prettier --write .",
Expand Down
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import enforceCloseTestingModuleRule from './rules/enforce-close-testing-module.

// TODO: we should type this as ESLint.Plugin but there's a type incompatibilities with the utils package
const plugin = {
configs: {
recommended: {
rules: { '@trilon/enforce-close-testing-module': 'error' },
},
},
rules: {
'@trilon/enforce-close-testing-module': enforceCloseTestingModuleRule,
'enforce-close-testing-module': enforceCloseTestingModuleRule,
},
};

Expand Down
44 changes: 22 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,28 @@ __metadata:
languageName: node
linkType: hard

"@trilon/eslint-plugin@workspace:.":
version: 0.0.0-use.local
resolution: "@trilon/eslint-plugin@workspace:."
dependencies:
"@types/eslint": "npm:^8"
"@types/node": "npm:^20.10.7"
"@typescript-eslint/eslint-plugin": "npm:^6.13.1"
"@typescript-eslint/parser": "npm:^6.13.1"
"@typescript-eslint/rule-tester": "npm:^6.13.1"
"@typescript-eslint/utils": "npm:^6.13.1"
eslint: "npm:^8.54.0"
eslint-config-prettier: "npm:^9.0.0"
prettier: "npm:^3.1.0"
rimraf: "npm:^5.0.5"
tsc-alias: "npm:^1.8.8"
tsx: "npm:^4.6.2"
typescript: "npm:^5.3.2"
peerDependencies:
eslint: ">=8.0.0"
languageName: unknown
linkType: soft

"@types/eslint@npm:^8":
version: 8.44.8
resolution: "@types/eslint@npm:8.44.8"
Expand Down Expand Up @@ -927,28 +949,6 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin@workspace:.":
version: 0.0.0-use.local
resolution: "eslint-plugin@workspace:."
dependencies:
"@types/eslint": "npm:^8"
"@types/node": "npm:^20.10.7"
"@typescript-eslint/eslint-plugin": "npm:^6.13.1"
"@typescript-eslint/parser": "npm:^6.13.1"
"@typescript-eslint/rule-tester": "npm:^6.13.1"
"@typescript-eslint/utils": "npm:^6.13.1"
eslint: "npm:^8.54.0"
eslint-config-prettier: "npm:^9.0.0"
prettier: "npm:^3.1.0"
rimraf: "npm:^5.0.5"
tsc-alias: "npm:^1.8.8"
tsx: "npm:^4.6.2"
typescript: "npm:^5.3.2"
peerDependencies:
eslint: ">=8.0.0"
languageName: unknown
linkType: soft

"eslint-scope@npm:^7.2.2":
version: 7.2.2
resolution: "eslint-scope@npm:7.2.2"
Expand Down

0 comments on commit 303eb44

Please sign in to comment.