Skip to content

Commit

Permalink
Added eslint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyMitch committed Apr 17, 2024
1 parent 285bdb4 commit afb2c38
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 6 deletions.
48 changes: 48 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports = {
globals: {
module: "readonly",
},
env: {
node: true,
},
parser: "@typescript-eslint/parser",
extends: [
// By extending from a plugin config, we can get recommended rules
// without having to add them manually.
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
// This disables the formatting rules in ESLint that Prettier is going to be responsible for handling.
// Make sure it's always the last config, so it gets the chance to override other configs.
"eslint-config-prettier",
],
plugins: ["prettier"],
settings: {
// Tells eslint how to resolve imports.
"import/resolver": {
node: {
paths: ["src"],
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
rules: {
"no-console": "off", // Allow console logging in backend code.
"prettier/prettier": "error",
"no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], // Ignore unused function arguments starting with _
"no-use-before-define": [
"error",
{ functions: false, classes: true, variables: true },
], // Allow variable hoisting for easier-to-read code.
"prefer-const": "error", // Encourage use of const where possible.
"@typescript-eslint/ban-types": [
"error",
{
types: {
Function: false, // Allow use of the 'Function' type.
},
extendDefaults: true,
},
],
},
ignorePatterns: ["node_modules/", "package-lock.json", "build/", "coverage/"],
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ package-lock.json
tsconfig.tsbuildinfo
build
releases
coverage
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
build
package-lock.json
coverage
10 changes: 10 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
trailingComma: "all",
tabWidth: 2,
semi: true,
singleQuote: true,
printWidth: 100,
bracketSpacing: true,
endOfLine: "lf",
arrowParens: "always",
};
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-typescript": "11.1.6",
"@types/node": "20.11.10",
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.3",
"husky": "9.0.11",
"prettier": "3.2.5",
"rollup-plugin-dts": "6.1.0",
"tslib": "2.6.2",
"typescript": "5.3.3"
Expand Down
19 changes: 13 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{
"compilerOptions": {
"target": "ESnext",
"module": "ESNext",
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "./build",
"rootDir": "./src",
"rootDir": ".",
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"strict": true,
"declaration": true,
"esModuleInterop": true,
"skipLibCheck": true,
"exactOptionalPropertyTypes": true,
"removeComments": true,
"sourceMap": true
"sourceMap": true,
"resolveJsonModule": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
"include": ["src/**/*.ts", "__tests__"],
"exclude": ["node_modules", "build", "coverage"]
}

0 comments on commit afb2c38

Please sign in to comment.