Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Support for Angular and Nestjs along with Docs #11

Merged
merged 21 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fe87ac2
changes: added nextjs config folder and update config
raj-vc Dec 19, 2023
32737b6
add config file for nestjs
vc-lbmadesia Dec 20, 2023
8a3a886
changes: update folder name
raj-vc Dec 20, 2023
ba4c299
resolve issue of not found page .prettierrc file
vc-lbmadesia Dec 20, 2023
8311dde
chanse path of lintstagedrc.json for react
vc-lbmadesia Dec 20, 2023
e4dfaa9
fix:update folder path for react config
raj-vc Dec 20, 2023
4a31e7c
fix: max-length issue esLint rule
vc-lbmadesia Dec 21, 2023
39b0fb7
Merge pull request #5 from vcian/feature/nestjs
raj-vc Dec 21, 2023
d0150f5
feat: Add Docs for the Config files
stavan-vc Dec 21, 2023
147c8fd
fix: Add extension detail to doc
stavan-vc Dec 21, 2023
3b8b59d
feat: Added angular lint config
vc-vishakha Dec 22, 2023
9f87aff
Merge pull request #7 from vcian/feature/angular-config
vc-vishakha Dec 27, 2023
597def5
feat: Add GitLens Extension Details
stavan-vc Dec 27, 2023
7bc5e99
Merge pull request #6 from vcian/docs/config-docs
stavan-vc Dec 27, 2023
b41f535
feat: Add docs for angular config files
vc-vishakha Dec 27, 2023
aac689a
Merge pull request #8 from vcian/docs/angular-config-docs
stavan-vc Dec 28, 2023
ac1c275
fixed: change EsLint run commnad for nestjs
vc-lbmadesia Dec 28, 2023
a24bd35
Merge pull request #9 from vcian/feature/nestjs
stavan-vc Dec 28, 2023
bd870d7
documentation: ESLint and Prettier config documentation for nestjs
vc-lbmadesia Dec 29, 2023
c94bb9a
Merge pull request #10 from vcian/docs/nestjs-config-docs
stavan-vc Dec 29, 2023
1077fc6
docs: added config docs and bump version and update changelog
raj-vc Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.0.0

_Jan 3, 2024_

- Added support for the Angular( [@vc-vishakha](https://github.com/vc-vishakha) in [#7](https://github.com/vcian/lint-sage/pull/7) )
- Added support for the Nestjs( [@vc-lbmadesia](https://github.com/vc-lbmadesia) in [#5](https://github.com/vcian/lint-sage/pull/5) ).
- Added Documentation for configs in Angular, Next js and Nest js.

## 1.1.1

_Dec 8, 2023_
Expand Down
88 changes: 88 additions & 0 deletions config/angular/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:@typescript-eslint/eslint-recommended"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"max-len": [
"error",
{
"code": 120
}
],
"semi": [
"error",
"always"
],
"@typescript-eslint/member-delimiter-style": [
"warn",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": true
}
}
],
"no-magic-numbers": [
"warn",
{
"ignoreArrayIndexes": true,
"ignoreDefaultValues": true,
"ignoreClassFieldInitialValues": true,
"ignore": [
-1,
0,
1
]
}
],
"no-console": "error",
"no-extra-boolean-cast": "off"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended",
"plugin:@angular-eslint/template/accessibility"
],
"rules": {
"prefer-template": 1
}
}
]
}
9 changes: 9 additions & 0 deletions config/angular/.lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"**/*.{js,ts}": [
"eslint --fix",
"prettier --config ./.prettierrc.json --write"
],
"**/*.{css,scss,md,html,json}": [
"prettier --config ./.prettierrc.json --write"
]
}
21 changes: 21 additions & 0 deletions config/angular/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"printWidth": 80,
"tabWidth": 2,
"trailingComma": "es5",
"singleQuote": true,
"semi": true,
"bracketSpacing": true,
"endOfLine": "lf",
"overrides": [
{
"files": [
"**/*.css",
"**/*.scss",
"**/*.html"
],
"options": {
"singleQuote": false
}
}
]
}
File renamed without changes.
4 changes: 3 additions & 1 deletion config/.prettierignore → config/common/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.next
.cache
package-lock.json
dist
public
node_modules
next-env.d.ts
next.config.ts
next.config.ts
/.angular/cache
4 changes: 3 additions & 1 deletion config/extensions.json → config/common/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"yzhang.markdown-all-in-one",
"christian-kohler.path-intellisense",
"esbenp.prettier-vscode",
"sonarsource.sonarlint-vscode"
"chakrounanas.turbo-console-log",
"sonarsource.sonarlint-vscode",
"eamodio.gitlens"
]
}
File renamed without changes.
File renamed without changes.
80 changes: 80 additions & 0 deletions config/nestjs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'warn',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-invalid-this': 'off',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/return-await': 'warn',
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/naming-convention': [
'error',
{ selector: 'default', format: ['strictCamelCase'] },
{
selector: 'variable',
format: ['strictCamelCase', 'UPPER_CASE', 'PascalCase'],
},
{
selector: 'parameter',
modifiers: ['unused'],
format: ['strictCamelCase'],
leadingUnderscore: 'allow',
},
{ selector: 'property', format: null },
{ selector: 'typeProperty', format: null },
{ selector: 'typeLike', format: ['StrictPascalCase'] },
{ selector: 'enumMember', format: ['UPPER_CASE'] },
],
'no-useless-return': 'error',
'no-constant-condition': 'warn',
'max-len': [
'error',
{
code: 200,
},
],
'max-lines': [
'error',
{
max: 1000,
},
],
'no-multiple-empty-lines': [
'error',
{
max: 2,
maxEOF: 1,
},
],
'no-console': 'error',
'no-mixed-operators': 'error',
'keyword-spacing': 'error',
'multiline-ternary': ['error', 'never'],
'no-undef': 'error',
'no-whitespace-before-property': 'error',
'nonblock-statement-body-position': 'error',
},
};
9 changes: 9 additions & 0 deletions config/nestjs/.lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"{src,apps,libs,test}/**/*.ts": [
"eslint --fix",
"prettier --config ./.prettierrc --write"
],
"{src,apps,libs,test}/**/*.json": [
"prettier --config ./.prettierrc --write"
]
}
8 changes: 8 additions & 0 deletions config/nestjs/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"semi": true,
"tabWidth": 2,
"trailingComma": "all",
"printWidth": 80,
"endOfLine": "auto"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
52 changes: 52 additions & 0 deletions docs/angular/eslintrc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ESLint Configuration (.eslintrc.json)

## Overview

The `.eslintrc.json` file is used with ESLint, a JavaScript and TypeScript linter, to enforce coding standards, catch errors, and maintain a consistent codebase.

The `.eslintrc.json` file is essential for enforcing coding standards and maintaining a consistent codebase in TypeScript and Angular projects. Customize based on project requirements.

### `root`

- **Description:** Indicates that this `.eslintrc.json` is the root configuration file.
- **Value:** `true`

### `ignorePatterns`

- **Description:** Defines patterns for files and directories to be ignored by ESLint.
- **Value:**
- `projects/**/*`: Ignores all files under the `projects` directory.

### `overrides`

#### TypeScript Files (`*.ts`)

- **Description:** Configuration specifically for TypeScript files.

- `extends`
- `eslint:recommended`: Inherits recommended ESLint rules.
- `plugin:@typescript-eslint/recommended`: Includes recommended TypeScript ESLint rules.
- `plugin:@angular-eslint/recommended`: Integrates recommended Angular ESLint rules.
- `plugin:@angular-eslint/template/process-inline-templates`: Handles inline template processing for Angular.
- `plugin:@typescript-eslint/eslint-recommended`: Recommends ESLint rules for TypeScript from TypeScript ESLint.

- `rules`
- `@angular-eslint/directive-selector`: Specifies directives' naming conventions.
- `@angular-eslint/component-selector`: Specifies component naming conventions.
- `max-len`: Sets maximum line length to 120 characters.
- `semi`: Enforces the usage of semicolons.
- `@typescript-eslint/member-delimiter-style`: Specifies member delimiter style for TypeScript.
- `no-magic-numbers`: Disallows magic numbers except for specific cases.
- `no-console`: Disallows the usage of `console` statements.
- `no-extra-boolean-cast`: Allows extra boolean casts.

#### HTML Files (`*.html`)

- **Description:** Configuration specifically for HTML files.

- `extends`
- `plugin:@angular-eslint/template/recommended`: Incorporates recommended Angular template ESLint rules.
- `plugin:@angular-eslint/template/accessibility`: Focuses on template accessibility rules.

- `rules`
- `prefer-template`: Encourages the use of template literals in HTML.
21 changes: 21 additions & 0 deletions docs/angular/lintstagedrc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# lint-staged Configuration (.lintstagedrc.json)

## Overview

The `.lintstagedrc.json` file configures lint-staged, a Git pre-commit hook tool, to run specific tasks on files that are staged for commit.

The `.lintstagedrc.json` file optimizes the pre-commit process by focusing linting and formatting tasks on staged files. Customize the configuration based on project requirements and coding conventions.

### Configuration Details

- **Pattern: `**/\*.{js,ts}`**

- **Description:** Targets JavaScript and TypeScript files for linting and formatting.
- **Tasks:**
- `eslint --fix`: Runs ESLint with the fix option to automatically correct linting issues.
- `prettier --config ./.prettierrc.json --write`: Runs Prettier with a specific configuration file to format code.

- **Pattern: `**/\*.{css,scss,md,html,json}`**
- **Description:** Targets CSS, SCSS, Markdown, HTML, and JSON files for formatting.
- **Task:**
- `prettier --config ./.prettierrc.json --write`: Runs Prettier with a specific configuration file to format code.
57 changes: 57 additions & 0 deletions docs/angular/prettier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Prettier Configuration (.prettierrc.json)

## Overview

The `.prettierrc.json` file is used with Prettier, a code formatter, to define code styling rules and formatting options.

The `.prettierrc.json` file sets Prettier formatting rules, ensuring code consistency and adherence to styling preferences. Customize these settings according to project requirements and coding conventions.


### `printWidth`

- **Description:** Specifies the maximum line width before wrapping.
- **Value:** `80`

### `tabWidth`

- **Description:** Specifies the number of spaces per indentation-level.
- **Value:** `2`

### `trailingComma`

- **Description:** Controls the usage of trailing commas in object literals and arrays.
- **Value:** `"es5"`

### `singleQuote`

- **Description:** Defines whether to use single quotes instead of double quotes for strings.
- **Value:** `true`

### `semi`

- **Description:** Indicates whether to add a semicolon at the end of statements.
- **Value:** `true`

### `bracketSpacing`

- **Description:** Controls whether to add spaces inside object literals' curly braces.
- **Value:** `true`

### `endOfLine`

- **Description:** Specifies the type of line endings.
- **Value:** `"lf"`

### `overrides`

- **Description:** Allows specific configurations for certain file types.

#### CSS, SCSS, HTML Files

- `files`
- `"**/*.css"`
- `"**/*.scss"`
- `"**/*.html"`
- `options`
- `singleQuote`: `false` (Overrides single quotes for these file types)

Loading