@anolilab/eslint-config 4.0.3 → 4.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### @anolilab/eslint-config [4.0.4](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@4.0.3...@anolilab/eslint-config@4.0.4) (2022-05-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fixed more found issues with the config loading ([f8042c9](https://github.com/anolilab/javascript-style-guide/commit/f8042c91c6b8bfc3b009e014fb34e978c6c64b32))
7
+
1
8
  ### @anolilab/eslint-config [4.0.3](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@4.0.2...@anolilab/eslint-config@4.0.3) (2022-05-16)
2
9
 
3
10
 
package/README.md CHANGED
@@ -111,52 +111,7 @@ As for whether two spaces or four spaces are used for indentation and whether th
111
111
 
112
112
  `@anolilab/eslint-config` does not include all style-related rules, so there is no need to install `eslint-config-prettier`. Install `prettier` and if you use `VSCode` the related plugins.
113
113
 
114
- Here is a `.prettierrc.cjs` configuration used by Anolilab Team for reference only:
115
-
116
- ```js
117
- // .prettierrc.cjs
118
- export default {
119
- // max 120 characters per line
120
- printWidth: 120,
121
- // use 2 spaces for indentation
122
- tabWidth: 4,
123
- // use spaces instead of indentations
124
- useTabs: false,
125
- // semicolon at the end of the line
126
- semi: true,
127
- // use single quotes
128
- singleQuote: false,
129
- // object's key is quoted only when necessary
130
- quoteProps: 'as-needed',
131
- // use double quotes instead of single quotes in jsx
132
- jsxSingleQuote: false,
133
- // no comma at the end
134
- trailingComma: 'all',
135
- // spaces are required at the beginning and end of the braces
136
- bracketSpacing: true,
137
- // end tag of jsx need to wrap
138
- jsxBracketSameLine: false,
139
- // brackets are required for arrow function parameter, even when there is only one parameter
140
- arrowParens: 'always',
141
- // format the entire contents of the file
142
- rangeStart: 0,
143
- rangeEnd: Infinity,
144
- // no need to write the beginning @prettier of the file
145
- requirePragma: false,
146
- // No need to automatically insert @prettier at the beginning of the file
147
- insertPragma: false,
148
- // use default break criteria
149
- proseWrap: 'preserve',
150
- // decide whether to break the html according to the display style
151
- htmlWhitespaceSensitivity: 'css',
152
- // vue files script and style tags indentation
153
- vueIndentScriptAndStyle: false,
154
- // lf for newline
155
- endOfLine: 'lf',
156
- // formats quoted code embedded
157
- embeddedLanguageFormatting: 'auto',
158
- };
159
- ```
114
+ This the used [.prettierrc.cjs](../prettier-config/index.cjs) configuration by Anolilab Team only for reference.
160
115
 
161
116
  ## Using experimental features with JavaScript
162
117
 
package/config.cjs CHANGED
@@ -69,7 +69,7 @@ testRules.forEach((depRule) => {
69
69
 
70
70
  if (hasTypescript) {
71
71
  pRules.push("typescript");
72
- extraInstalled.push(["@typescript-eslint/parser", "@typescript-eslint/eslint-plugin"]);
72
+ extraInstalled.push(["typescript", "@typescript-eslint/parser"], ["typescript", "@typescript-eslint/eslint-plugin"]);
73
73
 
74
74
  if (hasAnyDep("eslint-plugin-typescript-sort-keys")) {
75
75
  pRules.push("typescript-sort-keys");
package/index.cjs CHANGED
@@ -6,7 +6,7 @@ const { rules, pluginRules, extraInstallPackage } = require("./config.cjs");
6
6
  // Workaround VS Code trying to run this file twice!
7
7
  if (!global.hasAnolilabEsLintConfigLoaded) {
8
8
  checkMissing(pluginRules, extraInstallPackage);
9
- showLoaded(pluginRules, []);
9
+ showLoaded(pluginRules, extraInstallPackage);
10
10
 
11
11
  global.hasAnolilabEsLintConfigLoaded = true;
12
12
  }
@@ -1,7 +1,7 @@
1
1
  const isModuleAvailable = require("./is-module-available.cjs");
2
2
  const { consoleLog } = require("./loggers.cjs");
3
3
 
4
- const moduleNotAvailable = (package_) => !isModuleAvailable(package_.split("@")[0]);
4
+ const moduleNotAvailable = (package_) => !isModuleAvailable(package_);
5
5
 
6
6
  const atLatest = (package_) => {
7
7
  if (!package_.split("@").includes("@")) {
@@ -42,7 +42,10 @@ or
42
42
 
43
43
  yarn add ${notInstalled.map((element) => atLatest(element)).join(" ")} --dev
44
44
 
45
- `);
45
+ or
46
+
47
+ pnpm add ${notInstalled.map((element) => atLatest(element)).join(" ")} -D
48
+ `);
46
49
 
47
50
  // process.exit(1); // eslint-disable-line unicorn/no-process-exit
48
51
  };
@@ -1,13 +1,21 @@
1
1
  const { consoleLog, consolePlugin } = require("./loggers.cjs");
2
2
 
3
3
  module.exports = function showLoaded(rules, extraInstallPackage) {
4
+ const all = [...rules];
5
+
4
6
  extraInstallPackage.forEach(([rule, package_]) => {
5
- if (rules.includes(rule)) {
6
- rules.push(package_);
7
+ if (all.includes(rule)) {
8
+ all.push(package_);
7
9
  }
8
10
  });
9
11
 
10
12
  consoleLog("\n@anolilab/eslint-config loaded the following packages:\n");
11
13
 
12
- rules.forEach((element) => { consolePlugin(element); });
14
+ all.forEach((element) => {
15
+ if (element[0] === "@") {
16
+ consoleLog(` ${element}`);
17
+ } else {
18
+ consolePlugin(element);
19
+ }
20
+ });
13
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anolilab/eslint-config",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "ESLint shareable config for the Anolilab JavaScript style guide.",
5
5
  "keywords": [
6
6
  "css",
@@ -79,7 +79,7 @@
79
79
  "devDependencies": {
80
80
  "@testing-library/dom": "8.13.0",
81
81
  "@typescript-eslint/eslint-plugin": "^5.19.0",
82
- "@typescript-eslint/parser": "5.23.0",
82
+ "@typescript-eslint/parser": "5.24.0",
83
83
  "eslint": "8.15.0",
84
84
  "eslint-find-rules": "4.1.0",
85
85
  "eslint-plugin-babel": "5.3.1",
@@ -4,6 +4,16 @@ const { rules: baseES6Rules } = require("../es6.cjs");
4
4
  const { rules: baseImportsRules } = require("./import.cjs");
5
5
  const { rules: baseStyleRules } = require("../style.cjs");
6
6
  const { rules: baseVariablesRules } = require("../variables.cjs");
7
+ const { hasDep } = require("../../lib/utils.cjs");
8
+ const { consoleLog } = require("../../lib/loggers.cjs");
9
+
10
+ let { indent } = baseStyleRules;
11
+
12
+ if (hasDep("prettier")) {
13
+ consoleLog("Found prettier as dependency, disabling the '@typescript-eslint/indent' rule to fix wrong behavior of the rule; @see https://github.com/typescript-eslint/typescript-eslint/issues/1824");
14
+
15
+ indent = "off";
16
+ }
7
17
 
8
18
  module.exports = {
9
19
  overrides: [
@@ -92,7 +102,7 @@ module.exports = {
92
102
  // Replace 'indent' rule with '@typescript-eslint' version
93
103
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
94
104
  indent: "off",
95
- "@typescript-eslint/indent": baseStyleRules.indent,
105
+ "@typescript-eslint/indent": indent,
96
106
 
97
107
  // Replace 'keyword-spacing' rule with '@typescript-eslint' version
98
108
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md