Skip to content

Commit

Permalink
Add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
nktpro committed Apr 9, 2024
1 parent 541a1ff commit f2c1ef0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ code_quality() {
deno fmt --check
echo "Linting..."
deno lint
echo "Running eslint..."
eslint .
}

auto_fmt() {
Expand Down
21 changes: 21 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { execSync } = require("node:child_process");
const { dirname } = require("node:path");

const whichEslint = execSync("which eslint");
const eslintPath = dirname(dirname(whichEslint.toString().trim()));
const tseslint = require(`${eslintPath}/node_modules/typescript-eslint/dist/index.js`);

module.exports = tseslint.config(
...tseslint.configs.recommended.map(({ rules, ...rest }) => rest),
{
files: ["**/*.ts"],
rules: {
"@typescript-eslint/await-thenable": "error",
},
languageOptions: {
parserOptions: {
project: `${__dirname}/tsconfig.json`,
},
}
}
);
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
inherit (pkgs)
kubectl
;
inherit (hotPotPkgs)
typescript-eslint
;
};
in
{
Expand Down
15 changes: 15 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"experimentalDecorators": false,
"inlineSourceMap": false,
"isolatedModules": true,
"lib": ["ESNext", "DOM"],
"module": "esnext",
"moduleDetection": "force",
"strict": true,
"target": "esnext",
"useDefineForClassFields": true
}
}

0 comments on commit f2c1ef0

Please sign in to comment.