Skip to content

Commit 0417bf7

Browse files
authoredJan 17, 2025··
Merge pull request #4 from acadevmy/feat/miscellaneous-fixes
Feat/miscellaneous fixes and improvements
2 parents 7d8ca1c + b5d331f commit 0417bf7

File tree

4 files changed

+66
-62
lines changed

4 files changed

+66
-62
lines changed
 

‎.eslintrc.js

-5
This file was deleted.

‎.github/workflows/release.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,19 @@ jobs:
2121
- name: Setup Corepack
2222
run: |
2323
corepack enable
24-
corepack prepare npm@10.8.1 --activate
24+
corepack prepare --activate
2525
2626
- name: Install dependencies
27-
run: npm install
27+
run: pnpm install
2828

2929
- name: Build project
30-
run: npm run build
30+
run: pnpm run build
31+
32+
- name: Lint project
33+
run: pnpm run lint
3134

3235
- name: Run Semantic Release
3336
env:
3437
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
3538
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36-
run: npm run release
39+
run: pnpm run release

‎README.md

+34-52
Original file line numberDiff line numberDiff line change
@@ -4,83 +4,65 @@ This library provides ESLint configurations with the recommended rules from the
44

55
## Installation
66

7+
**npm:**
78
```bash
89
npm install --save-dev @devmy/eslint-plugin
910
```
1011

11-
## Usage
12+
**pnpm:**
13+
```bash
14+
pnpm add -D @devmy/eslint-plugin
15+
```
1216

13-
### Typescript
17+
**yarn**
18+
```bash
19+
yarn add --dev @devmy/eslint-plugin
20+
```
1421

15-
```js
16-
// .eslintrc.js
17-
module.exports = {
18-
extends: [
19-
'plugin:@devmy/eslint-plugin/recommended'
20-
]
21-
};
22+
**bun**
23+
```bash
24+
bun add -d @devmy/eslint-plugin
2225
```
2326

24-
### Angular
27+
**Note:** If you installed ESLint globally then you must also install `@devmy/eslint-plugin` globally.
2528

26-
```js
27-
// .eslintrc.js
28-
module.exports = {
29-
extends: [
30-
'plugin:@devmy/eslint-plugin/angular-recommended'
31-
]
32-
};
33-
```
29+
## Usage
3430

35-
### Angular with separate template configuration
36-
```js
37-
// eslint.config.js
38-
const tseslint = require("typescript-eslint");
39-
const devmy = require("@devmy/eslint-plugin");
40-
41-
module.exports = tseslint.config(
42-
{
43-
files: ["**/*.ts"],
44-
plugins: { "devmy": devmy },
45-
extends: [devmy.configs["angular-recommended"]],
46-
},
47-
{
48-
files: ["**/*.html"],
49-
plugins: { "devmy": devmy },
50-
extends: [devmy.configs["angular-template-recommended"]],
51-
}
52-
);
53-
```
31+
If you're using flat configuration:
5432

55-
### Cypress
33+
With
34+
[flat configuration](https://eslint.org/docs/latest/use/configure/configuration-files),
35+
just import the plugin and away you go:
5636

5737
```js
5838
// .eslintrc.js
39+
const pluginDevmy = require('@devmy/eslint-plugin');
40+
5941
module.exports = {
6042
extends: [
61-
'plugin:@devmy/eslint-plugin/cypress-recommended'
43+
pluginDevmy.configs.recommended
6244
]
6345
};
6446
```
6547

66-
### Jest
48+
With legacy configuration, add `@devmy/eslint-plugin` to the plugins section of your `.eslintrc`
49+
configuration file:
6750

68-
```js
69-
// .eslintrc.js
70-
module.exports = {
71-
extends: [
72-
'plugin:@devmy/eslint-plugin/jest-recommended'
73-
]
74-
};
51+
```json
52+
{
53+
"extends": ["plugin:@devmy/eslint-plugin/recommended"]
54+
}
7555
```
7656

7757
## Configurations
7858

79-
- **recommended**: The base configuration for TypeScript projects.
80-
- **angular-recommended**: Extends the "recommended" configuration with rules specific to Angular projects.
81-
- **angular-template-recommended**: Provides recommended rules for Angular templates.
82-
- **cypress-recommended**: Provides recommended rules for Cypress projects.
83-
- **jest-recommended**: Provides recommended rules for jest tests.
59+
| **Configuration** | **full name** | **Description** |
60+
|-----------------------------|------------------------------------------|-------------------------------------------------------|
61+
| **recommended** | `@devmy/eslint-plugin/recommended` | The base configuration for TypeScript projects. |
62+
| **angular-recommended** | `@devmy/eslint-plugin/angular-recommended` | Extends the "recommended" configuration with rules specific to Angular projects. |
63+
| **angular-template-recommended** | `@devmy/eslint-plugin/angular-template-recommended` | Provides recommended rules for Angular templates. |
64+
| **cypress-recommended** | `@devmy/eslint-plugin/cypress-recommended` | Provides recommended rules for Cypress projects. |
65+
| **jest-recommended** | `@devmy/eslint-plugin/jest-recommended` | Provides recommended rules for jest tests. |
8466

8567
## Contributing
8668

‎src/configs/recommended.ts

+25-1
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,35 @@ export default tsEslint.config({
3232
"@stylistic/space-before-blocks": "error",
3333
"@stylistic/padding-line-between-statements": [
3434
"error",
35+
// Space after directive, es "use client"
36+
{ blankLine: "always", prev: "directive", next: "*" },
37+
{ blankLine: "any", prev: "directive", next: "directive" },
38+
39+
// Space before import
40+
{ blankLine: "always", prev: "import", next: "*" },
41+
{ blankLine: "any", prev: "import", next: "import" },
42+
43+
// Space before return
44+
{ blankLine: "always", prev: "*", next: "return" },
45+
46+
// Space before and after logic statements (if, while, for, etc.)
3547
{
3648
blankLine: "always",
3749
prev: "*",
38-
next: "return",
50+
next: ["if", "while", "for", "switch", "try"],
51+
},
52+
{
53+
blankLine: "always",
54+
prev: ["if", "while", "for", "switch", "try"],
55+
next: "*",
3956
},
57+
58+
// Space before functions
59+
{ blankLine: "always", prev: "*", next: "function" },
60+
61+
// Space after blocks
62+
{ blankLine: "always", prev: "block-like", next: "*" },
63+
{ blankLine: "always", prev: "*", next: "block-like" },
4064
],
4165
"@typescript-eslint/array-type": ["error", { default: "array-simple" }],
4266
"@typescript-eslint/ban-ts-comment": 0,

0 commit comments

Comments
 (0)