Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
.pnp.*
!.yarn/releases
!.yarn/plugins
dist
node_modules
lib
node_modules
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,28 @@ 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 | Description | Recommended |
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------- | ----------- |
| [`@trilon/enforce-close-testing-module`](docs/rules/enforce-close-testing-module.md) | Ensures NestJS testing modules are closed properly after tests | ✅ |
27 changes: 22 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,53 @@
{
"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/**/*",
"package.json",
"README.md",
"LICENSE"
],
"engines": {
"node": ">=20.9.0",
"yarn": ">=4.0.2"
},
"scripts": {
"tsc": "tsc",
"prepare": "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 .",
"lint": "eslint . --ext .ts --max-warnings 0"
},
"keywords": [
"eslint",
"eslintplugin"
"eslintplugin",
"nestjs",
"nest",
"trilon"
],
"author": "Trilon Team",
"license": "ISC",
"packageManager": "[email protected]",
"devDependencies": {
"@types/eslint": "^8",
"@types/node": "^20.10.7",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"@typescript-eslint/rule-tester": "^6.13.1",
"@typescript-eslint/utils": "^6.13.1",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"prettier": "^3.1.0",
"rimraf": "^5.0.5",
"tsc-alias": "^1.8.8",
"tsx": "^4.6.2",
"typescript": "^5.3.2"
},
"peerDependencies": {
"eslint": ">=8.0.0"
}
}
15 changes: 15 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import enforceCloseTestingModuleRule from './rules/enforce-close-testing-module.rule';

// 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: {
'enforce-close-testing-module': enforceCloseTestingModuleRule,
},
};

module.exports = plugin;
8 changes: 8 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*ts"],
"exclude": ["tests"],
"compilerOptions": {
"rootDir": "./src"
}
}
Loading