Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(ref) Using custom logic for lint command #328

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ module.exports = {
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
],
rules: {
'no-console': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
semi: [2, 'always'],
'prettier/prettier': 'error',
'prettier/prettier': ['error', { trailingComma: 'es5' }],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-namespace': 'off',
'comma-dangle': 'off',
},
};
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"semi": true,
"singleQuote": true,
"tabWidth": 2
"tabWidth": 2,
"trailingComma": "es5"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"clean": "rm -rf ./node_modules && rm -rf ./coverage && rm -rf ./logs && yarn run clean:config",
"clean:config": "find ./conf -maxdepth 1 -regextype posix-extended -regex '.*.*' -delete",
"format": "prettier . --write",
"lint": "eslint src test test-scripts --format table --fix",
"lint": "node ./run-eslint.js",
"dev": "nodemon src/index.ts",
"dev:debug": "NODE_ENV=dev DEBUG=* nodemon src/index.ts",
"start": "/bin/bash ./startup.sh",
Expand Down
21 changes: 21 additions & 0 deletions run-eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// This script runs eslint on the src and test directories synchronously, and logs the output to the console.
// We can use async way but for now this is better for tracking the output.
const { execSync } = require('child_process');

// TODO: 'test-bronze' is a directory is too big to check all at once, keep it separate for now
const directories = ['src', 'test', 'test-helpers'];

directories.forEach((dir) => {
console.log(`Checking directory: ${dir}`);
try {
const result = execSync(`eslint ${dir} --format table --fix`, {
stdio: 'inherit',
});
console.log(result.toString());
} catch (err) {
console.error(
`Error checking directory ${dir}:`,
err.stdout?.toString() || err.message || err
);
}
});