Skip to content

Commit

Permalink
feat: Add a nest configuration for linting BE development projects
Browse files Browse the repository at this point in the history
  • Loading branch information
joncursi committed Sep 26, 2024
1 parent 0a99df3 commit 807197e
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 15 deletions.
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,29 @@ commit:
## Configure ESLint

To configure [ESLint](https://eslint.org/), add the following to your
`package.json` file. This will allow ESLint to discover the configuration this
repository provides from within your `node_modules` folder, and will check
your `*.js`, `*.ts`, and `*.tsx` files for infractions every time you create a
new commit:
`.eslintrc.js` and `package.json` files. This will allow ESLint to discover the
configuration this repository provides from within your `node_modules` folder,
and will check your `*.js`, `*.ts`, and `*.tsx` files for infractions every
time you create a new commit:

```json
...
"eslintConfig": {
...
"extends": [
...
"@actinc/eslint-config",
...
],
```js
module.exports = {
extends: [
// For front-end (React / Next.js) projects:
'@actinc/eslint-config'
// For back-end (Nest.js) projects:
'@actinc/eslint-config/nest'
]
...
},
// Add any custom rules/plugins/configuration here
}
```

```json
...
"lint-staged": {
...
"*.{js,ts,tsx}": "eslint",
"*.{js,jsx,ts,tsx}": "eslint",
...
},
...
Expand Down
48 changes: 48 additions & 0 deletions src/nest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright (c) Encoura, LLC and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const baseConfig = require('./index');

const controllerConfig = {
files: ['**/*.controller.ts'],
};

const entityConfig = {
files: ['**/*.entity.ts'],
rules: {
camel_case: 'off',
},
};

const moduleConfig = {
files: ['**/*.module.ts'],
rules: {
'@typescript-eslint/no-extraneous-class': 'off',
},
};

const serviceConfig = {
files: ['**/*.service.ts'],
rules: {
'filenames/match-exported': 'off',
},
};

module.exports = {
...baseConfig,
overrides: [
...baseConfig.overrides,
controllerConfig,
entityConfig,
moduleConfig,
serviceConfig,
],
rules: {
...baseConfig.rules,
'filenames/match-exported': 'off',
},
};

0 comments on commit 807197e

Please sign in to comment.