Skip to content

Commit

Permalink
Update eslint and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardocavazza committed Jan 30, 2024
1 parent d9bf22b commit 4f1a58b
Show file tree
Hide file tree
Showing 11 changed files with 1,852 additions and 1,772 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ root = true
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Matches multiple files with brace expansion notation
# Set default charset
Expand Down
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "@chialab/eslint-config/javascript/node"
"extends": "@chialab/eslint-config",
"env": {
"node": true
}
}
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
timeout-minutes: 5
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: yarn

Expand All @@ -35,10 +35,10 @@ jobs:
needs: lint
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: yarn

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
timeout-minutes: 5
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: yarn

- name: Install project dependencies
run: yarn install

- name: Lint
run: yarn lint
run: yarn lint
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.changeset
CHANGELOG.md
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["EditorConfig.EditorConfig", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
33 changes: 33 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"editor.formatOnSave": true,
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,36 @@ Chialab's rules for [Prettier](https://prettier.io/).

Install Prettier:

```sh
$ npm i -D prettier
```
npm i -D prettier
```

```
yarn add -D prettier
```

Install `@chialab/prettier-config`:

```sh
$ npm i -D @chialab/prettier-config
```
npm i -D @chialab/prettier-config
```

```
yarn add -D @chialab/prettier-config
```

Create a `prettier.config.cjs` file and add the configuration:
Create a `prettier.config.js` file and add the configuration:

**prettier.config.js**

**prettier.config.cjs**
```js
module.exports = {
...require('@chialab/prettier-config'),
};
import config from '@chialab/prettier-config';

export default config;
```

## IDE

Install the Prettier extension for your IDE (optional):

* [VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Chialab <[email protected]> (https://www.chialab.it)",
"main": "index.js",
"scripts": {
"lint": "eslint index.js"
"lint": "prettier --check . && eslint index.js"
},
"files": [
"LICENSE",
Expand All @@ -29,7 +29,9 @@
},
"devDependencies": {
"@changesets/cli": "^2.22.0",
"@chialab/eslint-config": "^3.0.0",
"eslint": "^8.0.0"
"@chialab/eslint-config": "^4.0.0",
"eslint": "^8.0.0",
"prettier": "^3.2.4",
"typescript": "^5.3.3"
}
}
1 change: 1 addition & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./index.js');
Loading

0 comments on commit 4f1a58b

Please sign in to comment.