Skip to content

Commit 21252f5

Browse files
author
nathanieliov
committed
Introduce ESLint and Prettier with standardized configurations
1 parent 6868bba commit 21252f5

File tree

6 files changed

+647
-9
lines changed

6 files changed

+647
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ tcpsigner.log
1818
logs/
1919
federate-node.jar
2020
zlogs/
21+
.eslintcache

.prettierignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Dependency Directories
2+
node_modules/
3+
4+
# Build Outputs
5+
dist/
6+
build/
7+
coverage/
8+
9+
# Auto-generated artifacts
10+
package-lock.json
11+
pnpm-lock.yaml
12+
13+
# OS / Editor junk
14+
.DS_Store
15+
.idea/
16+
.vscode/
17+
18+
# File types to ignore
19+
*.json
20+
*.xml
21+
*.md
22+
*.yml
23+
*.yaml

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 4,
7+
"useTabs": false,
8+
"arrowParens": "always",
9+
"endOfLine": "lf",
10+
"bracketSpacing": true
11+
}

eslint.config.cjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const js = require('@eslint/js');
2+
const globals = require('globals');
3+
const prettierRecommended = require('eslint-plugin-prettier/recommended');
4+
5+
const JS_FILES = ['**/*.js']; // only .js files (not .mjs/.cjs)
6+
7+
module.exports = [
8+
// Optional global ignores
9+
{ ignores: ['node_modules/**', 'dist/**', 'coverage/**'] },
10+
11+
// Apply everything below only to .js files
12+
{ files: JS_FILES },
13+
14+
// Equivalent of "extends: ['eslint:recommended']"
15+
js.configs.recommended,
16+
17+
// Your environment + language options
18+
{
19+
files: JS_FILES,
20+
languageOptions: {
21+
ecmaVersion: 2021,
22+
sourceType: 'module',
23+
globals: {
24+
...globals.node,
25+
...globals.es2021,
26+
...globals.mocha,
27+
},
28+
},
29+
rules: {
30+
'no-console': 'warn',
31+
'prettier/prettier': 'error',
32+
},
33+
},
34+
35+
// Equivalent of "plugin:prettier/recommended" (keep last)
36+
prettierRecommended,
37+
];

0 commit comments

Comments
 (0)