@@ -8,7 +8,7 @@ An ESLint plugin which provides JavaScript and TypeScript rules of the Creedengo
88
99### Installation
1010
11- You'll need to install [ ESLint] ( https://eslint.org/ ) (v7 or v8 ) and this plugin:
11+ You'll need to install [ ESLint] ( https://eslint.org/ ) (v7+ ) and this plugin:
1212
1313``` sh
1414# yarn
@@ -32,19 +32,54 @@ yarn add -D eslint @green-code-initiative/creedengo-eslint-plugin
3232npm install -D eslint @green-code-initiative/creedengo-eslint-plugin
3333```
3434
35- ### Enable whole plugin
35+ ### Enable plugin with recommended configuration
3636
37- Add ` @creedengo ` recommended configuration to ` extends ` section of your ` .eslintrc ` :
37+ #### ESLint Flat Configuration ( ` eslint.config.js ` )
3838
39- ``` jsonc
39+ Add ` @creedengo ` ** "flat/recommended"** configuration to your ` eslint.config.js ` :
40+
41+ ``` js
42+ import creedengo from " @creedengo/eslint-plugin" ;
43+
44+ export default [
45+ /* other eslint configurations */
46+ creedengo .configs [" flat/recommended" ],
47+ ];
48+ ```
49+
50+ #### ESLint deprecated legacy configuration (` .eslintrc ` )
51+
52+ For legacy ESLint versions using the deprecated ` .eslintrc ` file, add the ` @creedengo ` ** "recommended"** configuration to the ` extends ` array :
53+
54+ ``` json
4055{
41- " extends" : [" plugin:@creedengo/recommended" ],
56+ "extends" : [" plugin:@creedengo/recommended" ]
4257}
4358```
4459
45- ### Enable only some rules
60+ ### Enable specific rules
61+
62+ #### ESLint Flat configuration (` eslint.config.js ` )
63+
64+ Add the ` creedengo ` plugin configuration to your ` eslint.config.js ` and select the rules to activate:
65+
66+ ``` js
67+ import creedengo from " @creedengo/eslint-plugin" ;
68+
69+ export default [
70+ /* other eslint configurations */
71+ {
72+ plugins: { " @creedengo" : creedengo },
73+ rules: {
74+ " @creedengo/no-multiple-access-dom-element" : " error" ,
75+ },
76+ },
77+ ];
78+ ```
79+
80+ #### ESLint deprecated legacy configuration (` .eslintrc ` )
4681
47- Add ` @creedengo ` to the ` plugins ` section of your ` .eslintrc ` , followed by rules configuration :
82+ If your project uses a legacy ESLint version, it may use as well the now deprecated ` .eslintrc ` file. In such case, add ` @creedengo ` to the ` plugins ` array, potentially followed by rules specific configurations :
4883
4984``` jsonc
5085{
@@ -59,9 +94,10 @@ Add `@creedengo` to the `plugins` section of your `.eslintrc`, followed by rules
5994
6095<!-- begin auto-generated configs list -->
6196
62- | | Name |
63- | :- | :------------ |
64- | ✅ | ` recommended ` |
97+ | | Name |
98+ | :- | :----------------- |
99+ | ✅ | ` flat/recommended ` |
100+ | ✅ | ` recommended ` |
65101
66102<!-- end auto-generated configs list -->
67103
@@ -70,25 +106,26 @@ Add `@creedengo` to the `plugins` section of your `.eslintrc`, followed by rules
70106<!-- begin auto-generated rules list -->
71107
72108⚠️ Configurations set to warn in.\
109+ ✅ Set in the ` flat/recommended ` configuration.\
73110✅ Set in the ` recommended ` configuration.
74111
75- | Name | Description | ⚠️ |
76- | :--------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | :- |
77- | [ avoid-autoplay] ( docs/rules/avoid-autoplay.md ) | Avoid autoplay for videos and audio content | ✅ |
78- | [ avoid-brightness-override] ( docs/rules/avoid-brightness-override.md ) | Should avoid to override brightness | ✅ |
79- | [ avoid-css-animations] ( docs/rules/avoid-css-animations.md ) | Avoid usage of CSS animations | ✅ |
80- | [ avoid-high-accuracy-geolocation] ( docs/rules/avoid-high-accuracy-geolocation.md ) | Avoid using high accuracy geolocation in web applications | ✅ |
81- | [ avoid-keep-awake] ( docs/rules/avoid-keep-awake.md ) | Avoid screen keep awake | ✅ |
82- | [ limit-db-query-results] ( docs/rules/limit-db-query-results.md ) | Should limit the number of returns for a SQL query | ✅ |
83- | [ no-empty-image-src-attribute] ( docs/rules/no-empty-image-src-attribute.md ) | Disallow usage of image with empty source attribute | ✅ |
84- | [ no-import-all-from-library] ( docs/rules/no-import-all-from-library.md ) | Should not import all from library | ✅ |
85- | [ no-multiple-access-dom-element] ( docs/rules/no-multiple-access-dom-element.md ) | Disallow multiple access of same DOM element | ✅ |
86- | [ no-multiple-style-changes] ( docs/rules/no-multiple-style-changes.md ) | Disallow multiple style changes at once | ✅ |
87- | [ no-torch] ( docs/rules/no-torch.md ) | Should not programmatically enable torch mode | ✅ |
88- | [ prefer-collections-with-pagination] ( docs/rules/prefer-collections-with-pagination.md ) | Prefer API collections with pagination | ✅ |
89- | [ prefer-lighter-formats-for-image-files] ( docs/rules/prefer-lighter-formats-for-image-files.md ) | Prefer lighter formats for image files | ✅ |
90- | [ prefer-shorthand-css-notations] ( docs/rules/prefer-shorthand-css-notations.md ) | Encourage usage of shorthand CSS notations | ✅ |
91- | [ provide-print-css] ( docs/rules/provide-print-css.md ) | Enforce providing a print stylesheet | ✅ |
112+ | Name | Description | ⚠️ |
113+ | :--------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | :-- |
114+ | [ avoid-autoplay] ( docs/rules/avoid-autoplay.md ) | Avoid autoplay for videos and audio content | ✅ |
115+ | [ avoid-brightness-override] ( docs/rules/avoid-brightness-override.md ) | Should avoid to override brightness | ✅ |
116+ | [ avoid-css-animations] ( docs/rules/avoid-css-animations.md ) | Avoid usage of CSS animations | ✅ |
117+ | [ avoid-high-accuracy-geolocation] ( docs/rules/avoid-high-accuracy-geolocation.md ) | Avoid using high accuracy geolocation in web applications | ✅ |
118+ | [ avoid-keep-awake] ( docs/rules/avoid-keep-awake.md ) | Avoid screen keep awake | ✅ |
119+ | [ limit-db-query-results] ( docs/rules/limit-db-query-results.md ) | Should limit the number of returns for a SQL query | ✅ |
120+ | [ no-empty-image-src-attribute] ( docs/rules/no-empty-image-src-attribute.md ) | Disallow usage of image with empty source attribute | ✅ |
121+ | [ no-import-all-from-library] ( docs/rules/no-import-all-from-library.md ) | Should not import all from library | ✅ |
122+ | [ no-multiple-access-dom-element] ( docs/rules/no-multiple-access-dom-element.md ) | Disallow multiple access of same DOM element | ✅ |
123+ | [ no-multiple-style-changes] ( docs/rules/no-multiple-style-changes.md ) | Disallow multiple style changes at once | ✅ |
124+ | [ no-torch] ( docs/rules/no-torch.md ) | Should not programmatically enable torch mode | ✅ |
125+ | [ prefer-collections-with-pagination] ( docs/rules/prefer-collections-with-pagination.md ) | Prefer API collections with pagination | ✅ |
126+ | [ prefer-lighter-formats-for-image-files] ( docs/rules/prefer-lighter-formats-for-image-files.md ) | Prefer lighter formats for image files | ✅ |
127+ | [ prefer-shorthand-css-notations] ( docs/rules/prefer-shorthand-css-notations.md ) | Encourage usage of shorthand CSS notations | ✅ |
128+ | [ provide-print-css] ( docs/rules/provide-print-css.md ) | Enforce providing a print stylesheet | ✅ |
92129
93130<!-- end auto-generated rules list -->
94131
0 commit comments