-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(eslint-config-ng): Extract eslint config to a new project. Allows…
… using it in a JSON config file
- Loading branch information
Showing
14 changed files
with
94 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
This library provides some default config you can use for ESLint in an Angular project. It gives you all the recommended, community-standard rules from ESLint, | ||
@typescript-eslint, and @angular-eslint/recommended, plus these additions and changes: | ||
|
||
- code complexity rules to keep your functions and files focused and readable | ||
- relaxed rules around `ban-types` that Simonton Software has found unuseful | ||
|
||
# Installation | ||
|
||
1. First install [Angular ESLint](https://github.com/angular-eslint/angular-eslint) following their instructions for your situation. Make sure it is working with their minimal config. | ||
1. `yarn add -D @s-libs/eslint-config-ng` | ||
1. Change `.eslintrc.json` in your root directory to this, and make adjustments to suit your needs: | ||
|
||
```json | ||
{ | ||
"extends": "@s-libs/eslint-config-ng", | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts"], | ||
"rules": { | ||
"@angular-eslint/directive-selector": [ | ||
"error", | ||
{ "type": "attribute", "prefix": "app", "style": "camelCase" } | ||
], | ||
"@angular-eslint/component-selector": [ | ||
"error", | ||
{ "type": "element", "prefix": "app", "style": "kebab-case" } | ||
] | ||
} | ||
} | ||
] | ||
} | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@s-libs/eslint-config-ng", | ||
"version": "12.0.0-next.0", | ||
"author": "Simonton Software", | ||
"license": "MIT", | ||
"homepage": "https://github.com/simontonsoftware/s-libs/tree/master/projects/eslint-config-ng", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/simontonsoftware/s-libs.git", | ||
"directory": "projects/eslint-config-ng" | ||
}, | ||
"peerDependencies": { | ||
"@angular-eslint/eslint-plugin": "^12.0.0", | ||
"@angular-eslint/eslint-plugin-template": "^12.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.23.0", | ||
"@typescript-eslint/parser": "4.23.0", | ||
"eslint": "^7.26.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { libraries, runCommand } from './shared'; | ||
import { buildableLibraries, runCommand } from './shared'; | ||
|
||
for (const project of libraries) { | ||
for (const project of buildableLibraries) { | ||
runCommand(`yarn build --configuration production ${project}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { copyFileSync, mkdirSync, readdirSync, rmdirSync } from 'fs'; | ||
import { join } from 'path'; | ||
|
||
export function copyEslintConfig() { | ||
const targetFolder = 'dist/eslint-config-ng'; | ||
rmdirSync(targetFolder, { recursive: true }); | ||
mkdirSync(targetFolder); | ||
|
||
const srcFolder = 'projects/eslint-config-ng'; | ||
for (const file of readdirSync(srcFolder)) { | ||
copyFileSync(join(srcFolder, file), join(targetFolder, file)); | ||
} | ||
|
||
// deprecated config | ||
copyFileSync( | ||
'projects/ng-dev/deprecated-config/.eslintrc.js', | ||
'dist/ng-dev/.eslintrc.js', | ||
); | ||
copyFileSync( | ||
'projects/ng-dev/deprecated-config/tslint.angularcli.json', | ||
'dist/ng-dev/tslint.angularcli.json', | ||
); | ||
copyFileSync( | ||
'projects/ng-dev/deprecated-config/tslint.json', | ||
'dist/ng-dev/tslint.json', | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters