Skip to content

Commit

Permalink
Make final adjustments for v1
Browse files Browse the repository at this point in the history
GitHub Actions Workaround (#7)

githubactions bug

foo
  • Loading branch information
henriqueleite42 committed Apr 2, 2024
1 parent d80e662 commit 23498b8
Show file tree
Hide file tree
Showing 17 changed files with 3,246 additions and 3,028 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ jobs:
with:
node-version: "20"

- uses: pnpm/action-setup@v3
with:
version: 8

- name: Build
run: yarn build
run: pnpm run build

- uses: JS-DevTools/npm-publish@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"*{ts,js}": ["yarn format"]
"*{ts,js}": ["pnpm run format"]
}
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@
"typescriptreact"
],
"[javascript]": {
"editor.defaultFormatter": null
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": null
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascriptreact]": {
"editor.defaultFormatter": null
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.defaultFormatter": null
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},

// Code Spell Checker
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/econom

To test this package:

1. If you are testing and making changes, you may need run `yarn unlink`, but for your first time, you can ignore this
2. Run `yarn lk`
3. Go to another project that has some files with errors where you can test the rules and run `yarn link @econominhas/eslint-config`
1. If you are testing and making changes, you may need run `pnpm unlink`, but for your first time, you can ignore this
2. Run `pnpm run lk`
3. Go to another project that has some files with errors where you can test the rules and run `pnpm link --global @econominhas/eslint-config`
4. And it's done! Just give a look at the project and see if everything is working like you want.

**Tip:** You can use `npx eslint .` to lint the project automatically
Expand Down
145 changes: 82 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,29 @@ In this package, you can find the **Econominhas Style Guide**. We try to keep a
This config needs prettier and eslint to work, as it is only a config and not the real package.

```sh
yarn add -D @econominhas/eslint-config eslint prettier
pnpm add -D @econominhas/eslint-config eslint prettier
```

**Obs:** If you are using **VSCode**, you may need/want to do some [extra steps](#extra---vscode-tips--tricks).

## Basic Usage

1 - Create a `.eslintrc.json` file in the root of your project
1 - Create a `.eslintrc.js` file in the root of your project

2 - Put the following content inside the file:

```json
{
"root": true,
"extends": "@econominhas"
}
```js
module.exports = {
root: true,
extends: "@econominhas",
};
```

3 - Restart VSCode, and it's done!

## Modules

**Alert:** After any change at `.eslintrc.json` file, you should restart VSCode to ensure that it's working properly. This is a limitation of ESLint/VSCode, not our config.
**Alert:** After any change at `.eslintrc.js` file, you should restart VSCode to ensure that it's working properly. This is a limitation of ESLint/VSCode, not our config.

**Alert:** The **common module** must **ALWAYS** be extend, and must **ALWAYS** be the fist one.

Expand All @@ -91,13 +91,13 @@ The common module is the default rules used by every javascript project. It does

#### Usage

Create an `.eslintrc.json` file in the root folder of your package and add this content to it:
Create an `.eslintrc.js` file in the root folder of your package and add this content to it:

```json
{
"root": true,
"extends": "@econominhas"
}
```js
module.exports = {
root: true,
extends: "@econominhas",
};
```

</details>
Expand All @@ -114,16 +114,24 @@ Specific configs to projects that uses Jest.

#### Usage

Create an `.eslintrc.json` file in the root folder of your package and add this content to it:
Create an `.eslintrc.js` file in the root folder of your package and add this content to it:

```json
{
"root": true,
"extends": [
```js
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */

module.exports = {
root: true,
extends: [
"@econominhas", // The common module always should be extended!
"@econominhas/eslint-config/jest"
]
}
"@econominhas/eslint-config/jest",
],
settings: {
jest: {
version: require("jest/package.json").version,
},
},
};
```

</details>
Expand All @@ -140,16 +148,33 @@ Specific configs for typescript projects.

#### Usage

Create an `.eslintrc.json` file in the root folder of your package and add this content to it:
Create an `.eslintrc.js` file in the root folder of your package and add this content to it:

```json
{
"root": true,
"extends": [
```js
module.exports = {
root: true,
extends: [
"@econominhas", // The common module always should be extended!
"@econominhas/eslint-config/typescript"
]
}
"@econominhas/eslint-config/typescript",
],
};
```

#### Using another `tsconfig` for linting

By default, this module uses `tsconfig.json` file for configuring the typescript for the project, but you can use another file specifically for linting.

To use another file, simply add this to your `.eslintrc.js` file:

```js
/// .eslintrc.js
module.exports = {
// ...
parserOptions: {
project: "tsconfig.lint.json", // <<< Name of the tsconfig file here (Must be in the root folder of the project)
},
// ...
};
```

</details>
Expand All @@ -158,57 +183,51 @@ Create an `.eslintrc.json` file in the root folder of your package and add this

You can safely combine some modules, like this:

```json
{
"root": true,
"extends": [
```js
module.exports = {
root: true,
extends: [
"@econominhas", // The common module always should be extended!
"@econominhas/eslint-config/typescript",
"@econominhas/eslint-config/jest"
]
}
"@econominhas/eslint-config/jest",
],
};
```

## Warnings

### Problems with Prettier
## Extra - VSCode Tips & Tricks

### See the errors and warnings

<img src="https://dbaeumer.gallerycdn.vsassets.io/extensions/dbaeumer/vscode-eslint/3.0.5/1712051003124/Microsoft.VisualStudio.Services.Icons.Default" width="50" height="50">

If you are using the VSCode Prettier Extension, you need to disable it, because this package already configs the prettier and uses it under the hood. You can also **delete any prettier configuration files** from your project.
- Go to the VSCode Extensions Store
- Search for `dbaeumer.vscode-eslint` and install it

To disable Prettier, you just need to add this to the project's `.vscode/settings.json` file:
### Auto fix (most of) errors and warnings

Add this to the project's `.vscode/settings.json` file:

```json
{
// Make ESLint fix all the things that he can on save (like prettier formatting)
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},

// Change the default formatter to the ESLint Extension
"[javascript]": {
"editor.defaultFormatter": null
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": null
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascriptreact]": {
"editor.defaultFormatter": null
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.defaultFormatter": null
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
}
```

## Extra - VSCode Tips & Tricks

### See the errors and warnings

- Use `Ctrl + Shift + X`
- Search for `dbaeumer.vscode-eslint`
- Install the extension

### Auto fix issues

Add this to the project's `.vscode/settings.json` file:

```json
// Make ESLint fix all the things that he can on save (like prettier formatting)
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
```
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"type": "git",
"url": "git+https://github.com/econominhas/eslint-config.git"
},
"packageManager": "^[email protected]",
"keywords": [
"eslint",
"eslintconfig",
Expand Down Expand Up @@ -47,7 +48,6 @@
"eslint-config-standard": "^17.0.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^3.5.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jest-formatting": "^3.0.0",
Expand All @@ -69,8 +69,8 @@
"build": "./scripts/build.sh",
"format": "eslint . --fix --quiet",
"lint": "eslint . --quiet",
"upgrade:dependencies": "yarn upgrade-interactive --latest",
"lk": "yarn build && cd dist && yarn link && cd ..",
"ulk": "yarn unlink && yarn lk"
"upgrade:dependencies": "pnpm update --latest",
"lk": "pnpm run build && cd dist && pnpm link --global --dir . && cd ..",
"ulk": "pnpm unlink && pnpm run lk"
}
}
Loading

0 comments on commit 23498b8

Please sign in to comment.