Skip to content

Commit 7b3b504

Browse files
authored
Add commons repo and setup eslint (#30)
* Add commons repo and setup eslint * Fix eslint
1 parent cba8599 commit 7b3b504

11 files changed

+930
-489
lines changed

.eslintrc.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,19 @@ module.exports = {
77
},
88
parser: '@typescript-eslint/parser',
99
parserOptions: {
10+
project: ['./tsconfig.json'],
1011
ecmaVersion: 11,
1112
sourceType: 'module',
1213
},
1314
globals: {
1415
Atomics: 'readonly',
1516
SharedArrayBuffer: 'readonly',
1617
},
17-
extends: [
18-
'eslint:recommended',
19-
'plugin:@typescript-eslint/recommended',
20-
'plugin:@typescript-eslint/eslint-recommended',
21-
'plugin:import/recommended',
22-
'plugin:import/typescript',
23-
'plugin:jest/recommended',
24-
],
18+
extends: ['./node_modules/@api3/commons/dist/eslint/universal', './node_modules/@api3/commons/dist/eslint/jest'],
2519
plugins: ['@typescript-eslint', 'import', 'jest'],
2620
rules: {
21+
camelcase: 'off',
22+
2723
// TypeScript
2824
'@typescript-eslint/ban-ts-comment': 'off',
2925
'@typescript-eslint/ban-ts-ignore': 'off',
@@ -60,13 +56,14 @@ module.exports = {
6056

6157
// ESLint
6258
'comma-dangle': ['error', 'only-multiline'],
59+
eqeqeq: ['error', 'smart'],
6360
indent: 'off',
6461
'no-console': 'error',
6562
'no-useless-escape': 'off',
6663
semi: 'error',
67-
eqeqeq: ['error', 'smart'],
6864

6965
// Jest
66+
'jest/prefer-strict-equal': 'off',
7067
'jest/valid-title': 'off', // Prevents using "<function-name>.name" as a test name
7168
},
7269
};

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ coverage
1111
.DS_Store
1212
airseeker.json
1313
secrets.env
14+
.eslintcache

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { join } = require('path');
1+
const { join } = require('node:path');
22

33
/*
44
* For a detailed explanation regarding each configuration property and type check, visit:

jest.setup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ Object.defineProperty = function (object, name, meta) {
1717
};
1818

1919
// Disable logger if it is not explicitly set to true.
20-
process.env.LOGGER_ENABLED = process.env.LOGGER_ENABLED || 'false';
20+
process.env.LOGGER_ENABLED = process.env.LOGGER_ENABLED ?? 'false';

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
},
3232
"dependencies": {
3333
"@api3/airnode-protocol-v1": "^2.10.0",
34+
"@api3/commons": "^0.2.0",
3435
"@api3/promise-utils": "^0.4.0",
3536
"dotenv": "^16.3.1",
3637
"ethers": "^5.7.2",
@@ -41,8 +42,8 @@
4142
"build": "tsc --project tsconfig.build.json",
4243
"clean": "rm -rf coverage dist",
4344
"dev": "nodemon --ext ts,js,json,env --exec \"pnpm ts-node src/index.ts\"",
44-
"eslint:check": "eslint . --ext .js,.ts --max-warnings 0",
45-
"eslint:fix": "eslint . --ext .js,.ts --fix",
45+
"eslint:check": "eslint --report-unused-disable-directives --cache --ext js,ts . --max-warnings 0",
46+
"eslint:fix": "pnpm run eslint:check --fix",
4647
"prettier:check": "prettier --check \"./**/*.{js,ts,md,json}\"",
4748
"prettier:fix": "prettier --write \"./**/*.{js,ts,md,json}\"",
4849
"test": "jest",

0 commit comments

Comments
 (0)