Skip to content

Commit

Permalink
Merge pull request #117 from theodo-group/fix-lint-staged-error
Browse files Browse the repository at this point in the history
Fix lintstaged configuration
  • Loading branch information
Jeremie-Chauvel authored Oct 28, 2022
2 parents 427a5ad + 80fe2e1 commit 8b5f7b4
Show file tree
Hide file tree
Showing 16 changed files with 1,164 additions and 326 deletions.
164 changes: 164 additions & 0 deletions examples/bifrost-starter/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:prettier/recommended',
],
rules: {
'prettier/prettier': 'error',
'import/extensions': 0,
'import/no-unresolved': 0,
'import/prefer-default-export': 0,
'import/no-duplicates': 'error',
complexity: ['error', 8],
'max-lines': ['error', 200],
'max-depth': ['error', 3],
'max-params': ['error', 4],
eqeqeq: ['error', 'smart'],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
optionalDependencies: false,
peerDependencies: false,
},
],
'no-shadow': [
'error',
{
hoist: 'all',
},
],
'prefer-const': 'error',
'import/order': [
'error',
{
groups: [
['external', 'builtin'],
'unknown',
'internal',
['parent', 'sibling', 'index'],
],
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
'newlines-between': 'always',
pathGroupsExcludedImportTypes: ['builtin'],
},
],
'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
},
],
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: '*',
next: 'return',
},
],
'prefer-arrow/prefer-arrow-functions': [
'error',
{
disallowPrototype: true,
singleReturnOnly: false,
classPropertiesAllowed: false,
},
],
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'lodash',
message: 'Please use lodash/{module} import instead',
},
{
name: '.',
message: 'Please use explicit import file',
},
],
},
],
curly: ['error', 'all'],
},
root: true,
env: {
es6: true,
node: true,
browser: true,
},
plugins: ['prefer-arrow', 'import'],
parserOptions: {
ecmaVersion: 9,
sourceType: 'module',
},
overrides: [
{
files: ['**/*.ts?(x)'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
},
settings: { 'import/resolver': { typescript: {} } },
rules: {
'@typescript-eslint/prefer-optional-chain': 'error',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/strict-boolean-expressions': [
'error',
{
allowString: false,
allowNumber: false,
allowNullableObject: true,
},
],
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
minimumDescriptionLength: 10,
},
],
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/explicit-member-accessibility': 0,
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/ban-types': [
'error',
{
extendDefaults: true,
},
],
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowNumber: true,
allowBoolean: true,
},
],
},
},
],
};
1 change: 1 addition & 0 deletions examples/bifrost-starter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
.dockerignore
# Nx caching
nx-cache
.eslintcache
2 changes: 1 addition & 1 deletion examples/bifrost-starter/.lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
'*.{js,ts}': 'pnpm lint:fix',
'*.{js,ts,tsx}': 'pnpm lint:fix',
};
5 changes: 3 additions & 2 deletions examples/bifrost-starter/apps/backend/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
node_modules/
dist
node_modules
!.lintstagedrc.js
102 changes: 102 additions & 0 deletions examples/bifrost-starter/apps/backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
module.exports = {
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
rules: {
curly: ['error', 'all'],
eqeqeq: ['error', 'smart'],
complexity: ['error', 8],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
optionalDependencies: false,
peerDependencies: false,
},
],
'no-shadow': [
'error',
{
hoist: 'all',
},
],
'prefer-const': 'error',
'unused-imports/no-unused-imports-ts': 'error',
'import/order': [
'error',
{
groups: [['external', 'builtin'], 'internal', ['parent', 'sibling', 'index']],
},
],
'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
},
],
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: '*',
next: 'return',
},
],
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@nestjs/common',
importNames: ['Controller', 'Get', 'Post', 'Put', 'Patch', 'Delete'],
message:
'Please use our custom Http decorators. They are defined in decorators/controller.ts or decorators/httpDecorators.ts',
},
],
},
],
},
root: true,
plugins: ['import', 'unused-imports'],
env: {
browser: true,
es6: true,
node: true,
jest: true,
},
overrides: [
{
files: ['**/*.ts?(x)'],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
rules: {
'@typescript-eslint/prefer-optional-chain': 'error',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowNumber: true,
allowBoolean: true,
},
],
'@typescript-eslint/strict-boolean-expressions': [
'error',
{
allowString: false,
allowNumber: false,
allowNullableObject: true,
},
],
},
},
],
parserOptions: {
ecmaVersion: 2022,
},
};
100 changes: 0 additions & 100 deletions examples/bifrost-starter/apps/backend/.eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions examples/bifrost-starter/apps/backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
.DS_Store

npm-debug.log*
.eslintcache
1 change: 1 addition & 0 deletions examples/bifrost-starter/apps/backend/.lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../.lintstagedrc');
Loading

0 comments on commit 8b5f7b4

Please sign in to comment.