Skip to content

Commit cada9f2

Browse files
Merge pull request #75 from effekt-lang/linter-formatter
Add ESLint and Prettier as linter and formatter
2 parents 29e2716 + 77e881f commit cada9f2

11 files changed

Lines changed: 1653 additions & 833 deletions

.git-blame-ignore-revs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# .git-blame-ignore-revs
2+
3+
# using `git blame --ignore-revs-file .git-blame-ignore-revs`
4+
# or configuring git to always do so : `git config blame.ignoreRevsFile .git-blame-ignore-revs`
5+
6+
7+
# First time linting and formatting the whole codebase
8+
87e78e4db73d7f28aad21613bc64ed1ea80c4d6d
9+
10+
# Reformat with trailing commata on
11+
0c41364313629aa1cf42c0b1f40c3f78c7e48196

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,11 @@ jobs:
2121
- run: npm install -g vsce
2222
- run: npm install
2323

24+
- name: Run ESLint
25+
run: npm run lint
26+
27+
- name: Run Prettier Check
28+
run: npm run format:check
29+
2430
- name: Package VSCode extension into .vsix file
2531
run: vsce package

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "all",
4+
"singleQuote": true,
5+
"printWidth": 80
6+
}

eslint.config.mjs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* ESLint configuration for the project.
3+
*
4+
* See https://eslint.style and https://typescript-eslint.io for additional linting options.
5+
*/
6+
// @ts-check
7+
import js from '@eslint/js';
8+
import tseslint from 'typescript-eslint';
9+
import prettier from 'eslint-config-prettier';
10+
import prettierPlugin from 'eslint-plugin-prettier';
11+
12+
export default tseslint.config(
13+
{
14+
ignores: [
15+
'**/.vscode-test',
16+
'**/out',
17+
]
18+
},
19+
js.configs.recommended,
20+
...tseslint.configs.recommended,
21+
...tseslint.configs.stylistic,
22+
prettier, // Disable conflicting ESLint rules
23+
{
24+
plugins: {
25+
prettier: prettierPlugin // Enable Prettier plugin
26+
},
27+
rules: {
28+
'prettier/prettier': 'error', // Treat Prettier issues as ESLint errors
29+
'curly': 'warn',
30+
'@typescript-eslint/no-empty-function': 'off',
31+
'@typescript-eslint/naming-convention': [
32+
'warn',
33+
{
34+
'selector': 'import',
35+
'format': ['camelCase', 'PascalCase']
36+
}
37+
],
38+
'@typescript-eslint/no-unused-vars': [
39+
'error',
40+
{
41+
'argsIgnorePattern': '^_', // Allow unused variables with a prefix '_'
42+
'varsIgnorePattern': '^_' // Allow unused vars with a prefix '_'
43+
}
44+
],
45+
'@typescript-eslint/no-explicit-any': 'off' // Allow 'any' type
46+
}
47+
}
48+
);

0 commit comments

Comments
 (0)