-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2684 from exadel-inc/epic/eslint-clenup
feat(eslint-config): introducing shared eslint-config for esl projects
- Loading branch information
Showing
54 changed files
with
300 additions
and
197 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,9 @@ rules: | |
- patch | ||
- deps | ||
- deps-dev | ||
- lint | ||
- eslint-plugin | ||
- eslint-config | ||
- e2e | ||
- ci | ||
# Deprecated scopes: | ||
- lint |
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 |
---|---|---|
|
@@ -12,7 +12,8 @@ node_modules | |
*.tgz | ||
target | ||
site/dist | ||
eslint/dist | ||
|
||
eslint-plugin/dist | ||
|
||
# Generated surces | ||
/modules | ||
|
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,59 @@ | ||
# [ESL](../../../) Shared ESLint Configuration | ||
|
||
Authors: *Anastasiya Lesun, Alexey Stsefanovich (ala'n)*. | ||
|
||
<a name="intro"></a> | ||
|
||
Packages maintained by ESL Team often use ESLint to ensure code quality and consistency. | ||
To simplify the process of configuring ESLint for these packages, we have developed a shared ESLint configuration. | ||
This configuration is designed to be used as a base for ESLint configuration in projects that use ESL package, | ||
or decide to follow ESL source code style. | ||
|
||
<a name="installation"></a> | ||
|
||
### Installation | ||
|
||
To use ESL shared ESLint configuration, you need to install it as npm package: | ||
|
||
```bash | ||
npm install --save-dev @exadel/eslint-config-esl | ||
``` | ||
|
||
Ensure that you have the ESLint package of version 9.0.0 or higher, shared configuration is distributed only as flat ESLint config. | ||
|
||
Once installed, the configuration needs to be added in eslint configuration file: | ||
|
||
```js | ||
module.exports = [ | ||
// ESLint configuration ... | ||
|
||
// Apply ESL Shared ESLint Configuration | ||
...require('@exadel/eslint-config-esl').typescript, | ||
...require('@exadel/eslint-config-esl').recommended, | ||
]; | ||
``` | ||
|
||
<a name="configuration"></a> | ||
|
||
### Configuration | ||
|
||
There are no additional configuration options for ESL Shared ESLint Configuration at that moment. | ||
Please be aware that we are in the process of standardizing rule list and are currently considering supporting EcmaScript in addition to TypeScript. | ||
|
||
Still you are able to override any rule from the configuration in your project's ESLint configuration file | ||
by declaring it in the `rules` section of the configuration file after applying the shared configuration. | ||
|
||
### Inner Plugins | ||
|
||
ESL Shared ESLint Configuration includes several inner plugins that are used to provide additional rules and configurations for ESLint. | ||
Here is the list of included plugins and their ESLint aliases: | ||
|
||
- `@stylistic` - code style rules from [@stylistic](https://eslint.style/) project. | ||
- `typescript-eslint` - TypeScript specific rules from [TypeScript ESLint](https://typescript-eslint.io/) project. | ||
- `import` - rules for imports from [eslint-plugin-import-x](https://www.npmjs.com/package/eslint-plugin-import-x); | ||
- `tsdoc` - rules for TSDoc comments from [eslint-plugin-tsdoc](https://www.npmjs.com/package/eslint-plugin-tsdoc); | ||
- `sonarjs` - rules for code quality from [eslint-plugin-sonarjs](https://www.npmjs.com/package/eslint-plugin-sonarjs); | ||
Note: uses 1.*.* version of the plugin due to incompatibility with flat config. | ||
- `editorconfig` - rules for EditorConfig from [eslint-plugin-editorconfig](https://www.npmjs.com/package/eslint-plugin-editorconfig); | ||
|
||
All mentioned plugins could be used from shared configuration without additional installation. |
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,37 @@ | ||
/** Default TS Configuration */ | ||
module.exports.typescript = require('./rules/eslint.config.language'); | ||
|
||
/** Shared plugins */ | ||
module.exports.plugins = { | ||
get '@stylistic' () { | ||
return require('@stylistic/eslint-plugin') | ||
}, | ||
get 'editorconfig'() { | ||
return require('eslint-plugin-editorconfig'); | ||
}, | ||
get 'import'() { | ||
return require('eslint-plugin-import-x'); | ||
}, | ||
get 'tsdoc'() { | ||
return require('eslint-plugin-tsdoc'); | ||
}, | ||
get 'sonarjs'() { | ||
return require('eslint-plugin-sonarjs'); | ||
}, | ||
get 'typescript-eslint' () { | ||
return require('typescript-eslint') | ||
} | ||
}; | ||
|
||
/** Default ESLint Configuration */ | ||
module.exports.recommended = [ | ||
...require('./rules/eslint.config.codestyle'), | ||
...require('./rules/eslint.config.coderules'), | ||
...require('./rules/eslint.config.sonarjs'), | ||
...require('./rules/eslint.config.stylistic'), | ||
...require('./rules/eslint.config.editorconfig'), | ||
...require('./rules/eslint.config.import'), | ||
...require('./rules/eslint.config.tsdoc') | ||
]; | ||
|
||
// TODO: Separate ES / TS builder |
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,31 @@ | ||
{ | ||
"name": "@exadel/eslint-config-esl", | ||
"version": "5.0.0-beta.34", | ||
"keywords": [ | ||
"eslint", | ||
"eslint-config", | ||
"esl" | ||
], | ||
"license": "MIT", | ||
"description": "Shared ESLint config used by ESL (@exadel/esl) team. Internal projects usage.", | ||
"main": "index.js", | ||
"files": [ | ||
"index.js", | ||
"rules/*.js" | ||
], | ||
"scripts": { | ||
"test": "" | ||
}, | ||
"dependencies": { | ||
"@eslint/js": "^9.11.1", | ||
"@stylistic/eslint-plugin": "^2.8.0", | ||
"eslint-plugin-editorconfig": "^4.0.3", | ||
"eslint-plugin-import-x": "^4.3.1", | ||
"eslint-plugin-sonarjs": "^1.0.4", | ||
"eslint-plugin-tsdoc": "^0.3.0", | ||
"typescript-eslint": "^8.7.0" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">=9.0.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
File renamed without changes.
4 changes: 1 addition & 3 deletions
4
linting/eslint.config.editorconfig.js → ...onfig/rules/eslint.config.editorconfig.js
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
3 changes: 1 addition & 2 deletions
3
linting/eslint.config.language.js → ...nt-config/rules/eslint.config.language.js
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
4 changes: 1 addition & 3 deletions
4
linting/eslint.config.sonarjs.js → eslint-config/rules/eslint.config.sonarjs.js
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
4 changes: 1 addition & 3 deletions
4
linting/eslint.config.stylistic.js → ...t-config/rules/eslint.config.stylistic.js
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
4 changes: 1 addition & 3 deletions
4
linting/eslint.config.tsdoc.js → eslint-config/rules/eslint.config.tsdoc.js
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.