Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchere committed Jun 23, 2023
0 parents commit b6965a4
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 0 deletions.
107 changes: 107 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
sourceType: "module",
ecmaVersion: "latest",
emitDecoratorMetadata: true,
},
plugins: ["@typescript-eslint/eslint-plugin", "node"],
extends: [
"airbnb-base",
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"plugin:node/recommended-module",
"plugin:prettier/recommended",
"prettier",
],
root: true,
env: {
node: true,
jest: true,
},
settings: {
"import/resolver": {
typescript: {},
},
},
// TODO: Add data standards and off-chain directories
ignorePatterns: [
".eslintrc.cjs",
"test/setup.jest.cjs",
"types/google",
"src/data-standards/",
],
rules: {
// note you must disable the base rule as it can report incorrect errors
// https://github.com/typescript-eslint/typescript-eslint/issues/2484#issuecomment-687257773
"no-shadow": "off",
"no-use-before-define": "error",
"no-nested-ternary": "off",
"no-warning-comments": "warn",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/naming-convention": "warn",
// it doesn't understand top-level await
"node/no-unsupported-features/es-syntax": "warn",
"@typescript-eslint/no-empty-interface": "warn",
"node/no-unpublished-import": "warn",
"node/no-extraneous-import": "warn",
"max-classes-per-file": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-misused-promises": ["error"],
"node/no-missing-import": "off",
"import/no-cycle": "warn",
"@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": ["error"],
"no-console": "error",
"no-invalid-this": "error",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
disallowTypeAnnotations: true,
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-loop-func": "warn",
"import/prefer-default-export": "off",
// needed for TS and importing CJS modules
"import/extensions": [
"error",
"always",
{
ignorePackages: false,
pattern: {
"": "always",
ts: "never",
js: "never",
},
},
],
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": ["error"],
"no-empty-function": "off",
"import/no-extraneous-dependencies": "off",
"no-restricted-syntax": ["error", "WithStatement"],
"class-methods-use-this": "off",
"no-underscore-dangle": "off",
"@typescript-eslint/no-unused-vars": "error",
"no-await-in-loop": "off",
"no-continue": "off",
"no-plusplus": "off",
},
overrides: [
{
files: ["**/*.spec.ts"],
rules: {
"node/no-unpublished-import": "off",
},
},
],
};
13 changes: 13 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"singleQuote": false,
"trailingComma": "all",
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrder": ["<THIRD_PARTY_MODULES>", "^@/(.*)$", "^[./]"],
"importOrderSeparation": true,
"importOrderParserPlugins": [
"typescript",
"decorators-legacy",
"importAssertions"
],
"importOrderSortSpecifiers": true
}
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@jpg-store/eslint-config",
"version": "1.0.0",
"description": "Linting & formatting tools used by jpg.store",
"main": ".eslintrc.js",
"keywords": ["eslint", "eslintconfig"],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "MartinSchere",
"license": "ISC",
"peerDependencies": {
"eslint": ">= 3",
"eslint-config-airbnb": ">= 15",
"@typescript-eslint/eslint-plugin": ">= 4"
}
}
40 changes: 40 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "NodeNext",
"target": "ESNext",
"allowJs": true,
"checkJs": false,
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noEmitHelpers": true,
"importHelpers": true,
"allowSyntheticDefaultImports": false,
"resolveJsonModule": true,
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./src",
"incremental": true,
"composite": false,
"skipLibCheck": true,
"strictNullChecks": true,
"strict": true,
"noImplicitAny": false,
"strictBindCallApply": true,
"noUncheckedIndexedAccess": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
"esModuleInterop": true,
"paths": {
"@/*": ["./*"]
}
},
"ts-node": {
"experimentalSpecifierResolution": "node",
"experimentalResolver": true,
"preferTsExts": false,
"esm": true
}
}

0 comments on commit b6965a4

Please sign in to comment.