Skip to content

Commit c49ee1a

Browse files
chore(lint): add a minimal eslint configuration (stenciljs#3369)
this commit adds a very basic eslint setup. linting can be done through the command line, an npm script, and through ci as a result of this commit. the team is working on adding a new CI check for unused functions that which will depend on the configuration already being checked in on `main`, so I wanted to introduce a separate PR just to bring this in. the only rule turned on (for now) is the unused-vars rule. STENCIL-15: add initial eslint configuration
1 parent 157d095 commit c49ee1a

File tree

16 files changed

+1895
-100
lines changed

16 files changed

+1895
-100
lines changed

.eslintrc.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
root: true,
3+
parser: '@typescript-eslint/parser',
4+
plugins: ['@typescript-eslint'],
5+
extends: [
6+
// including prettier here ensures that we don't set any rules which will conflict
7+
// with Prettier's formatting. Keep it last in the list so that nothing else messes
8+
// with it!
9+
'prettier',
10+
],
11+
rules: {
12+
'@typescript-eslint/no-unused-vars': ['error', {
13+
"argsIgnorePattern": "^_",
14+
// TODO(STENCIL-452): Investigate using eslint-plugin-react to remove the need for varsIgnorePattern
15+
"varsIgnorePattern": "^(h|Fragment)$"
16+
}]
17+
},
18+
};

.github/workflows/format.yml renamed to .github/workflows/lint-and-format.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Format Stencil (Check)
1+
name: Lint and Format Stencil (Check)
22

33
on:
44
workflow_call:
@@ -19,3 +19,6 @@ jobs:
1919
- name: Prettier Check
2020
run: npm run prettier.dry-run
2121
shell: bash
22+
23+
- name: ESLint
24+
run: npm run lint

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
name: Build
1919
uses: ./.github/workflows/build.yml
2020

21-
format:
22-
name: Format
23-
uses: ./.github/workflows/format.yml
21+
lint_and_format:
22+
name: Lint and Format
23+
uses: ./.github/workflows/lint-and-format.yml
2424

2525
analysis_tests:
2626
name: Analysis Tests

0 commit comments

Comments
 (0)