@putout/plugin-nestjs 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) coderaiser
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @putout/plugin-nestjs [![NPM version][NPMIMGURL]][NPMURL]
2
+
3
+ [NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-nestjs.svg?style=flat&longCache=true
4
+ [NPMURL]: https://npmjs.org/package/@putout/plugin-nestjs "npm"
5
+
6
+ > Nest is a modern framework designed to build efficient, scalable web applications
7
+ >
8
+ > (c) [nestjs.com](https://nestjs.com/)
9
+
10
+ 🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability tosupport nestjs. *Not Bundled*.
11
+
12
+ ## Install
13
+
14
+ ```
15
+ npm i putout @putout/plugin-nestjs -D
16
+ ```
17
+
18
+ ## Rules
19
+
20
+ - βœ… [declare](#declare);
21
+
22
+ ## Config
23
+
24
+ ```json
25
+ {
26
+ "rules": {
27
+ "nestjs/declare": "on"
28
+ },
29
+ "plugin": ["nestjs"]
30
+ }
31
+ ```
32
+
33
+ ## declare
34
+
35
+ Add Nestjs declaration on top of a file.
36
+
37
+ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/a4f4099e9408fd6315cc1f72dafa2259/6baa344ed7976d92704e564f627abb00aeef6269).
38
+
39
+ ### ❌ Example of incorrect code
40
+
41
+ ```ts
42
+ @Injectable()
43
+ export class GistService {
44
+ constructor(private readonly githubService: GithubService) {}
45
+
46
+ load(gistId: string, revisionId?: string) {
47
+ return this.githubService.load(gistId, revisionId);
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### βœ… Example of correct code
53
+
54
+ ```ts
55
+ import {Injectable} from '@nestjs/common';
56
+
57
+ @Injectable()
58
+ export class GistService {
59
+ constructor(private readonly githubService: GithubService) {}
60
+
61
+ load(gistId: string, revisionId?: string) {
62
+ return this.githubService.load(gistId, revisionId);
63
+ }
64
+ }
65
+ ```
66
+
67
+ ## License
68
+
69
+ MIT
@@ -0,0 +1,10 @@
1
+ export const declare = () => ({
2
+ Body: 'import {Body} from "@nestjs/common"',
3
+ Get: 'import {Get} from "@nestjs/common"',
4
+ Post: 'import {Post} from "@nestjs/common"',
5
+ Patch: 'import {Patch} from "@nestjs/common"',
6
+ Param: 'import {Param} from "@nestjs/common"',
7
+ Module: 'import {Module} from "@nestjs/common"',
8
+ Controller: 'import {Controller} from "@nestjs/common"',
9
+ Injectable: 'import {Injectable} from "@nestjs/common"',
10
+ });
package/lib/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import * as declare from './declare/index.js';
2
+
3
+ export const rules = {
4
+ declare,
5
+ };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@putout/plugin-nestjs",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
+ "description": "🐊Putout plugin adds ability to migrate to latest version of Nest.js",
7
+ "homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-nestjs#readme",
8
+ "main": "lib/index.js",
9
+ "release": false,
10
+ "tag": false,
11
+ "changelog": false,
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/coderaiser/putout.git"
15
+ },
16
+ "scripts": {
17
+ "test": "madrun test",
18
+ "watch:test": "madrun watch:test",
19
+ "lint": "madrun lint",
20
+ "fresh:lint": "madrun fresh:lint",
21
+ "lint:fresh": "madrun lint:fresh",
22
+ "fix:lint": "madrun fix:lint",
23
+ "coverage": "madrun coverage",
24
+ "report": "madrun report"
25
+ },
26
+ "dependencies": {},
27
+ "keywords": [
28
+ "putout",
29
+ "putout-plugin",
30
+ "plugin",
31
+ "react",
32
+ "nestjs"
33
+ ],
34
+ "peerDependencies": {
35
+ "putout": ">=42"
36
+ },
37
+ "devDependencies": {
38
+ "@putout/test": "^15.0.0",
39
+ "eslint": "^10.0.0",
40
+ "eslint-plugin-putout": "^31.0.0",
41
+ "eslint-plugin-react": "^7.32.0",
42
+ "madrun": "^13.0.0",
43
+ "superc8": "^12.0.0"
44
+ },
45
+ "license": "MIT",
46
+ "engines": {
47
+ "node": ">=22"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ }
52
+ }