Skip to content

Instantly share code, notes, and snippets.

@akash-gajjar
Last active March 19, 2024 11:43
Show Gist options
  • Save akash-gajjar/31c770f039b242521d2c6aab81075831 to your computer and use it in GitHub Desktop.
Save akash-gajjar/31c770f039b242521d2c6aab81075831 to your computer and use it in GitHub Desktop.
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'prettier', 'import'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended', 'plugin:import/recommended',
'plugin:import/typescript',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
settings: {
'import/resolver': {
typescript: {
project: './tsconfig.json',
},
},
},
rules: {
'prettier/prettier': [
'error',
{
semi: true,
singleQuote: false,
trailingComma: 'all',
},
],
quotes: ["error", "double"],
'sort-imports': [
'error',
{
ignoreCase: false,
ignoreDeclarationSort: true, // don"t want to sort import lines, use eslint-plugin-import instead
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
allowSeparatedGroups: true,
},
],
'import/no-unresolved': 'error',
'import/order': [
'error',
{
groups: [
'builtin', // Built-in imports (come from NodeJS native) go first
'external', // <- External imports
'internal', // <- Absolute imports
['sibling', 'parent'], // <- Relative imports, the sibling and parent types they can be mingled together
'index', // <- index imports
'unknown', // <- unknown
],
'newlines-between': 'always',
alphabetize: {
/* sort in ascending order. Options: ["ignore", "asc", "desc"] */
order: 'asc',
/* ignore case. Options: [true, false] */
caseInsensitive: true,
},
},
],
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
/** disable eslint rule see: https://typescript-eslint.io/rules/no-unused-vars/#how-to-use */
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
},
};
/**
* @type {import("prettier").Config}
*/
const config = {
printWidth: 120,
singleQuote: false,
trailingComma: 'all',
semi: true,
endOfLine: 'lf',
jsxSingleQuote: false,
tabWidth: 2,
arrowParens: 'always',
};
module.exports = config;
{
"scripts": {
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "npm run lint -- --fix",
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"source-map-support": "^0.5.21",
"supertest": "^6.3.4",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0"
}
}
{
"editor.formatOnSave": false,
"eslint.validate": [
"typescript"
],
"editor.codeActionsOnSave": {
"source.fixAll": "always"
},
"cSpell.words": [
"Accessorial",
"Fluker",
"nestjs"
]
}
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2021",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
},
"exclude": [
"tmp",
"dist"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment