Skip to content

Commit 8932d98

Browse files
authored
feat: config is now a plugin (#18)
* feat: config is now a plugin * docs: update README * refactor: export recommendedConfig in other file * chore: rename eslint to eslint-plugin * fix: fix CI with new eslint-plugin directory * docs: rewind plugin README * fix: lint in eslint-plugin package * chore: add ts-check
1 parent 9dea93c commit 8932d98

13 files changed

Lines changed: 117 additions & 24 deletions

File tree

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"no examples 📝":
2-
- all: ["packages/eslint/**/*", "!packages/example-app/**/*"]
2+
- all: ["packages/eslint-plugin/**/*", "!packages/example-app/**/*"]

.github/workflows/quality-eslint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
name: Eslint-Config Quality
1+
name: Eslint-Plugin Quality
22

33
on: workflow_call
44

55
jobs:
66
quality-job:
7-
name: Eslint-Config Quality
7+
name: Eslint-Plugin Quality
88
runs-on: ubuntu-latest
99
timeout-minutes: 10
1010

1111
defaults:
1212
run:
1313
# default directory for 'run' actions only in steps
14-
working-directory: packages/eslint
14+
working-directory: packages/eslint-plugin
1515

1616
steps:
1717
- name: Checkout
@@ -21,12 +21,12 @@ jobs:
2121
id: setup-node
2222
uses: actions/setup-node@v3
2323
with:
24-
node-version-file: packages/eslint/.nvmrc
24+
node-version-file: packages/eslint-plugin/.nvmrc
2525

2626
- name: Load dependency cache
2727
uses: actions/cache@v3
2828
with:
29-
path: packages/eslint/node_modules
29+
path: packages/eslint-plugin/node_modules
3030
# add `-patches-${{ hashFiles('patches/**/*') }}` if you use patch-package
3131
key: eslint-${{ runner.os }}-node-${{ steps.setup-node.outputs.node-version }}-modules-${{ hashFiles('yarn.lock') }}
3232
restore-keys: |

.github/workflows/quality.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
with:
2121
filters: |
2222
eslint:
23-
- 'packages/eslint/**'
23+
- 'packages/eslint-plugin/**'
2424
- 'packages/example-app/**'
2525
2626
eslint-quality:
27-
name: Eslint-Config Quality
27+
name: Eslint-Plugin Quality
2828
needs: changes
2929
if: ${{ needs.changes.outputs.eslint == 'true' }}
3030
uses: ./.github/workflows/quality-eslint.yml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ There is also an example app under `packages/example-app` whose goal is to demon
1212

1313
## Using the configurations
1414

15-
- [Using ESLint configuration](./packages/eslint/README.md)
15+
- [Using ESLint plugin](./packages/eslint/README.md)
1616

1717
## Installing the project
1818

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use strict";
2+
3+
module.exports = {
4+
root: true,
5+
extends: [
6+
"eslint:recommended",
7+
"plugin:eslint-plugin/recommended",
8+
"plugin:node/recommended",
9+
],
10+
env: {
11+
node: true,
12+
},
13+
};
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# ESLint config for BAM
1+
# ESLint plugin for BAM
22

3-
This project is an ESLint config that gathers all the rules, plugins and parsers that should be used in any new BAM project.
3+
This project is an ESLint plugin that gathers all the rules, plugins and parsers that should be used in any new BAM project.
44

55
## How to use?
66

@@ -10,12 +10,12 @@ In your app, run
1010
yarn add --dev @bam.tech/eslint-config @typescript-eslint/eslint-plugin eslint eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-native prettier
1111
```
1212

13-
In your `.eslintrc` config file, extend the exported configuration:
13+
In your `.eslintrc` config file, extend the exported recommended configuration:
1414

1515
```json
1616
// .eslintrc
1717
{
18-
"extends": "@bam.tech/eslint-config"
18+
"extends": "plugin:@bam.tech/eslint-plugin/recommended"
1919
}
2020
```
2121

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @ts-check
2+
"use strict";
3+
4+
const recommended = require("./recommended");
5+
6+
module.exports = {
7+
configs: {
8+
recommended,
9+
},
10+
};
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
{
2-
"name": "@bam.tech/eslint-config",
2+
"name": "@bam.tech/eslint-plugin",
33
"version": "0.1.0",
4-
"main": "index.js",
4+
"description": "eslint plugin for bam projects",
5+
"keywords": [
6+
"eslint",
7+
"eslintplugin",
8+
"eslint-plugin"
9+
],
10+
"main": "./lib/index.js",
511
"license": "MIT",
612
"scripts": {
7-
"test": "echo 'No implemented tests... 😢'"
13+
"test": "echo 'No implemented tests... 😢'",
14+
"lint": "eslint ."
815
},
916
"peerDependencies": {
1017
"@typescript-eslint/eslint-plugin": ">= 5",
@@ -20,5 +27,9 @@
2027
"@typescript-eslint/parser": "^5.48.0",
2128
"eslint-config-prettier": "^8.8.0",
2229
"eslint-define-config": "^1.21.0"
30+
},
31+
"devDependencies": {
32+
"eslint-plugin-eslint-plugin": "^5.1.0",
33+
"eslint-plugin-node": "^11.1.0"
2334
}
2435
}

0 commit comments

Comments
 (0)