Skip to content

Commit

Permalink
chore(eslint-config): add missing build and publish process & basic d…
Browse files Browse the repository at this point in the history
…ocumentation
  • Loading branch information
ala-n committed Sep 27, 2024
1 parent c76f7bd commit 4dffa27
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 20 deletions.
5 changes: 4 additions & 1 deletion .releaserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ plugins:
- package.json
- package-lock.json
- site/package.json
- eslint-config/package.json
- eslint-plugin/package.json
message: "chore(release): ${nextRelease.version} \n\n${nextRelease.notes}"

Expand All @@ -76,6 +77,8 @@ plugins:
- path: ./exadel-esl-*.tgz
label: Released Core NPM Tarball
- path: ./exadel-eslint-plugin-esl-*.tgz
label: Released ESLint NPM Tarball
label: Released ESLint Config NPM Tarball
- path: ./exadel-eslint-config-esl-*.tgz
label: Released ESLint Plugin NPM Tarball
- path: CHANGELOG.md
label: Changelog
5 changes: 5 additions & 0 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ESL codebase is written using TypeScript and LESS CSS-preprocessor.

ESL uses the following tools to keep codebase quality
- ESLint to lint scripts
- Own ESLint shared configuration (see [eslint-config](../eslint-config) sub-package)
- StyleLint to lint styles
- Jest to run unit tests
- CommitLint to check commit message format
Expand Down Expand Up @@ -116,6 +117,10 @@ ESL project consists of the following directories:
- [📁 src](../eslint-plugin/src) - ESLint plugin sources
- [📁 test](../eslint-plugin/test) - ESLint plugin tests

- [📁 eslint-config](../eslint-config) - sub-package root for ESL ESLint shared configuration
- [📁 rules](../eslint-config/rules) - ESLint shared configuration rule sets
- [📄 index.js](../eslint-config/index.js) - ESLint shared configuration main file


- [📁 build](../build) - library common build scripts
- [📁 linting](../linting) - ES Lint rule-sets
Expand Down
59 changes: 59 additions & 0 deletions eslint-config/README.md
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 desided 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 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 asre in progress of standardizing rule list and currently considering of suporrting EcmaScript in addition to TypeScript.

Still yor 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 thair 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.
1 change: 0 additions & 1 deletion eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "@exadel/eslint-config-esl",
"private": true,
"version": "5.0.0-beta.34",
"keywords": [
"eslint",
Expand Down
43 changes: 27 additions & 16 deletions eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ To use custom ESLint plugin, you need to install it as npm package:
npm install --save-dev @exadel/eslint-plugin-esl
```

Once installed, the plugin needs to be added in eslint configuration file:
Once installed, the plugin needs to be added in eslint configuration file.

For ESLint 8.0.0 with legacy config:
```json
{
// ...
Expand All @@ -35,6 +36,16 @@ Or in YAML:
- "@exadel/esl"
```

For ESLint +8.0.0 with Flat config:
```js
module.exports = [
// ESLint configuration

// Apply Recomended ESL ESLint Plugin checks
...require('@exadel/eslint-plugin-esl').recommended,
];
```

<a name="configuration"></a>

### Configuration
Expand All @@ -54,24 +65,24 @@ However, you still have the option to manually manage the rules if needed.

The ESLint plugin provides a separate rule for each deprecated utility within the ESL project, that's considered to be deprecated. Below is the list of them:

- `@exadel/esl/deprecated-4/alert-action-params` - Rule for deprecated `AlertActionParams` alias for `ESLAlertActionParams`.
- `@exadel/esl/deprecated-4/generate-uid` - Rule for deprecated `generateUId` alias for `randUID`.
- `@exadel/esl/deprecated-4/deep-compare` - Rule for deprecated `deepCompare` alias for `isEqual`.
- `@exadel/esl/deprecated-4/event-utils` - Rule for deprecated `EventUtils` alias for `ESLEventUtils`.
- `@exadel/esl/deprecated-4/panel-action-params` - Rule for deprecated `PanelActionParams` alias for `ESLPanelActionParams`.
- `@exadel/esl/deprecated-4/popup-action-params` - Rule for deprecated `PopupActionParams` alias for `ESLPopupActionParams`.
- `@exadel/esl/deprecated-4/traversing-query` - Rule for deprecated `TraversingQuery` alias for `ESLTraversingQuery`.
- `@exadel/esl/deprecated-4/toggleable-action-params` - Rule for deprecated `ToggleableActionParams` alias for `ESLToggleableActionParams`.
- `@exadel/esl/deprecated-4/tooltip-action-params` - Rule for deprecated `TooltipActionParams` alias for `ESLTooltipActionParams`.
- `@exadel/esl/deprecated-4-alert-action-params` - Rule for deprecated `AlertActionParams` alias for `ESLAlertActionParams`.
- `@exadel/esl/deprecated-4-generate-uid` - Rule for deprecated `generateUId` alias for `randUID`.
- `@exadel/esl/deprecated-4-deep-compare` - Rule for deprecated `deepCompare` alias for `isEqual`.
- `@exadel/esl/deprecated-4-event-utils` - Rule for deprecated `EventUtils` alias for `ESLEventUtils`.
- `@exadel/esl/deprecated-4-panel-action-params` - Rule for deprecated `PanelActionParams` alias for `ESLPanelActionParams`.
- `@exadel/esl/deprecated-4-popup-action-params` - Rule for deprecated `PopupActionParams` alias for `ESLPopupActionParams`.
- `@exadel/esl/deprecated-4-traversing-query` - Rule for deprecated `TraversingQuery` alias for `ESLTraversingQuery`.
- `@exadel/esl/deprecated-4-toggleable-action-params` - Rule for deprecated `ToggleableActionParams` alias for `ESLToggleableActionParams`.
- `@exadel/esl/deprecated-4-tooltip-action-params` - Rule for deprecated `TooltipActionParams` alias for `ESLTooltipActionParams`.

- `@exadel/esl/deprecated-4/media-rule-list-parse` - Rule for deprecated `ESLMediaRuleList.parse` alias for `ESLMediaRuleList.parseQuery` or `ESLMediaRuleList.parseTuple`.
- `@exadel/esl/deprecated-4-media-rule-list-parse` - Rule for deprecated `ESLMediaRuleList.parse` alias for `ESLMediaRuleList.parseQuery` or `ESLMediaRuleList.parseTuple`.

- `@exadel/esl/deprecated-4/base-decorators-path` - Rule for deprecated `@attr`, `@prop`, `@boolAttr`, `@jsonAttr`, `@listen` import paths.
- `@exadel/esl/deprecated-4-base-decorators-path` - Rule for deprecated `@attr`, `@prop`, `@boolAttr`, `@jsonAttr`, `@listen` import paths.

- `@exadel/esl/deprecated-5/alert-action-params` - Rule for deprecated `AlertActionParams` alias for `ESLAlertActionParams`.
- `@exadel/esl/deprecated-5/panel-action-params` - Rule for deprecated `PanelActionParams` alias for `ESLPanelActionParams`.
- `@exadel/esl/deprecated-5/popup-action-params` - Rule for deprecated `PopupActionParams` alias for `ESLPopupActionParams`.
- `@exadel/esl/deprecated-5/tooltip-action-params` - Rule for deprecated `TooltipActionParams` alias for `ESLTooltipActionParams`.
- `@exadel/esl/deprecated-5-alert-action-params` - Rule for deprecated `AlertActionParams` alias for `ESLAlertActionParams`.
- `@exadel/esl/deprecated-5-panel-action-params` - Rule for deprecated `PanelActionParams` alias for `ESLPanelActionParams`.
- `@exadel/esl/deprecated-5-popup-action-params` - Rule for deprecated `PopupActionParams` alias for `ESLPopupActionParams`.
- `@exadel/esl/deprecated-5-tooltip-action-params` - Rule for deprecated `TooltipActionParams` alias for `ESLTooltipActionParams`.

These rules can be configured manually inside the `rules` section of your ESLint configuration file.

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
"prepare": "husky && npm run build",
"preversion": "npm test",
"version": "cross-env-shell \"npm version $npm_package_version --no-git-tag-version --ws\" && git add **/package*.json",
"postpack": "npm pack --workspace eslint-plugin",
"postpublish": "npm publish --workspace eslint-plugin",
"postpack": "npm pack --workspace eslint-plugin --workspace eslint-config",
"postpublish": "npm publish --workspace eslint-plugin --workspace eslint-config",
"fix:less": "stylelint --fix \"**/*.less\""
},
"dependencies": {
Expand Down

0 comments on commit 4dffa27

Please sign in to comment.