@anolilab/eslint-config 7.2.0 → 7.2.2

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,17 @@
1
+ ## @anolilab/eslint-config [7.2.2](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@7.2.1...@anolilab/eslint-config@7.2.2) (2023-06-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * extended postinstall script file checking ([5f867d7](https://github.com/anolilab/javascript-style-guide/commit/5f867d7b4d3acc9f2af4651b23f8e1a0d206e923))
7
+
8
+ ## @anolilab/eslint-config [7.2.1](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@7.2.0...@anolilab/eslint-config@7.2.1) (2023-06-25)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * changed eslint-plugin-es to eslint-plugin-es-x ([168c42e](https://github.com/anolilab/javascript-style-guide/commit/168c42ed9b66be6cc0bef3cbceeda1fa7c712424))
14
+
1
15
  ## @anolilab/eslint-config [7.2.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/eslint-config@7.1.0...@anolilab/eslint-config@7.2.0) (2023-06-25)
2
16
 
3
17
 
@@ -1,7 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var e={plugins:["es"],overrides:[{files:["*.js","*.jsx"],settings:{es:{aggressive:!0}}}]},s=e;
3
+ var chunkVJL7NPM4_js = require('../../chunk-VJL7NPM4.js');
4
4
 
5
- module.exports = s;
5
+ var t=chunkVJL7NPM4_js.a("all",{plugins:["es-x"],settings:{es:{aggressive:!0}}}),r=t;
6
+
7
+ module.exports = r;
6
8
  //# sourceMappingURL=out.js.map
7
9
  //# sourceMappingURL=es.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/config/plugins/es.ts"],"names":["config","es_default"],"mappings":"AAEA,IAAMA,EAAwB,CAC1B,QAAS,CAAC,IAAI,EAEd,UAAW,CACP,CACI,MAAO,CAAC,OAAQ,OAAO,EACvB,SAAU,CACN,GAAI,CAAE,WAAY,EAAK,CAC3B,CACJ,CACJ,CACJ,EAEOC,EAAQD","sourcesContent":["import type { Linter } from \"eslint\";\n\nconst config: Linter.Config = {\n plugins: [\"es\"],\n\n overrides: [\n {\n files: [\"*.js\", \"*.jsx\"],\n settings: {\n es: { aggressive: true },\n },\n },\n ],\n};\n\nexport default config;\n"]}
1
+ {"version":3,"sources":["../../../src/config/plugins/es.ts"],"names":["config","createConfig","es_default"],"mappings":"4CAIA,IAAMA,EAAwBC,EAAa,MAAO,CAC9C,QAAS,CAAC,MAAM,EAChB,SAAU,CACN,GAAI,CAAE,WAAY,EAAK,CAC3B,CACJ,CAAC,EAEMC,EAAQF","sourcesContent":["import type { Linter } from \"eslint\";\n\nimport { createConfig } from \"../../utils/create-config\";\n\nconst config: Linter.Config = createConfig(\"all\", {\n plugins: [\"es-x\"],\n settings: {\n es: { aggressive: true },\n },\n});\n\nexport default config;\n"]}
@@ -1,5 +1,7 @@
1
- var e={plugins:["es"],overrides:[{files:["*.js","*.jsx"],settings:{es:{aggressive:!0}}}]},s=e;
1
+ import { a } from '../../chunk-5IW32NSH.mjs';
2
2
 
3
- export { s as default };
3
+ var t=a("all",{plugins:["es-x"],settings:{es:{aggressive:!0}}}),r=t;
4
+
5
+ export { r as default };
4
6
  //# sourceMappingURL=out.js.map
5
7
  //# sourceMappingURL=es.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/config/plugins/es.ts"],"names":["config","es_default"],"mappings":"AAEA,IAAMA,EAAwB,CAC1B,QAAS,CAAC,IAAI,EAEd,UAAW,CACP,CACI,MAAO,CAAC,OAAQ,OAAO,EACvB,SAAU,CACN,GAAI,CAAE,WAAY,EAAK,CAC3B,CACJ,CACJ,CACJ,EAEOC,EAAQD","sourcesContent":["import type { Linter } from \"eslint\";\n\nconst config: Linter.Config = {\n plugins: [\"es\"],\n\n overrides: [\n {\n files: [\"*.js\", \"*.jsx\"],\n settings: {\n es: { aggressive: true },\n },\n },\n ],\n};\n\nexport default config;\n"]}
1
+ {"version":3,"sources":["../../../src/config/plugins/es.ts"],"names":["config","createConfig","es_default"],"mappings":"6CAIA,IAAMA,EAAwBC,EAAa,MAAO,CAC9C,QAAS,CAAC,MAAM,EAChB,SAAU,CACN,GAAI,CAAE,WAAY,EAAK,CAC3B,CACJ,CAAC,EAEMC,EAAQF","sourcesContent":["import type { Linter } from \"eslint\";\n\nimport { createConfig } from \"../../utils/create-config\";\n\nconst config: Linter.Config = createConfig(\"all\", {\n plugins: [\"es-x\"],\n settings: {\n es: { aggressive: true },\n },\n});\n\nexport default config;\n"]}
@@ -5,26 +5,28 @@ var fs = require('fs');
5
5
  var path = require('path');
6
6
  var util = require('util');
7
7
 
8
- process.env.CI&&process.exit(0);var p=util.promisify(fs.writeFile);console.log("Configuring @anolilab/eslint-config",packageJsonUtils.projectPath,`
9
- `);var h=()=>{let t=path.join(packageJsonUtils.projectPath,".eslintrc.js"),i="",l=`
8
+ process.env.CI&&process.exit(0);var f=util.promisify(fs.writeFile);console.log("Configuring @anolilab/eslint-config",packageJsonUtils.projectPath,`
9
+ `);var s=".eslintrc",d=()=>{for(let o of [s,`${s}.js`,`${s}.cjs`,`${s}.json`,`${s}.yaml`,`${s}.yml`])if(fs.existsSync(path.join(packageJsonUtils.projectPath,o)))return console.warn(`\u26A0\uFE0F ${o} already exists;
10
+ Make sure that it includes the following for @anolilab/eslint-config'
11
+ to work as it should: { extends: ["@anolilab/eslint-config"] }.`),Promise.resolve();let t=path.join(packageJsonUtils.projectPath,".eslintrc.js"),a="",c=`
10
12
  parserOptions: {
11
13
  ecmaVersion: "latest",
12
14
  sourceType: ${packageJsonUtils.packageIsTypeModule?'"module"':'"commonjs"'},
13
- },`,a=path.join(packageJsonUtils.projectPath,"tsconfig.json");if(fs.existsSync(a)){let c=JSON.parse(fs.readFileSync(a,"utf8")),e="latest";c.compilerOptions?.target&&(e=c.compilerOptions.target,e=e.toLowerCase()==="es2022"||e.toLowerCase()==="esnext"?"latest":e.toLowerCase().replace("es",""),e!=="latest"&&e!=="2022"&&e!=="2021"&&e!=="2021"&&e!=="6"&&(i=`, "plugin:es/restrict-to-es${e}"`)),l=`
15
+ },`,p=path.join(packageJsonUtils.projectPath,"tsconfig.json");if(fs.existsSync(p)){let o=JSON.parse(fs.readFileSync(p,"utf8")),e="latest";o.compilerOptions?.target&&(e=o.compilerOptions.target,e=e.toLowerCase()==="es2022"||e.toLowerCase()==="esnext"?"latest":e.toLowerCase().replace("es",""),e!=="latest"&&e!=="2022"&&e!=="2021"&&e!=="6"&&(a=`, "plugin:es-x/restrict-to-es${e}"`)),c=`
14
16
  parserOptions: {
15
17
  project: "./tsconfig.json",
16
18
  ecmaVersion: ${e==="latest"?`"${e}"`:e},
17
19
  sourceType: ${packageJsonUtils.packageIsTypeModule?'"module"':'"commonjs"'},
18
- },`;}let f=`/** @ts-check */
20
+ },`;}let m=`/** @ts-check */
19
21
  /** @type {import('eslint').Linter.Config} */
20
22
  ${packageJsonUtils.packageIsTypeModule?"export default":"module.exports ="} {
21
23
  root: true,
22
- extends: ["@anolilab/eslint-config"${i}],
24
+ extends: ["@anolilab/eslint-config"${a}],
23
25
  ignorePatterns: ["!**/*"],
24
26
  env: {
25
27
  // Your environments (which contains several predefined global variables)
26
28
  // Most environments are loaded automatically if our rules are added
27
- },${l}
29
+ },${c}
28
30
  globals: {
29
31
  // Your global variables (setting to false means it's not allowed to be reassigned)
30
32
  // myGlobal: false
@@ -58,8 +60,6 @@ ${packageJsonUtils.packageIsTypeModule?"export default":"module.exports ="} {
58
60
  },
59
61
  ],
60
62
  };
61
- `;return fs.existsSync(t)?(console.warn(`\u26A0\uFE0F .eslintrc.cjs already exists;
62
- Make sure that it includes the following for @anolilab/eslint-config'
63
- to work as it should: { extends: ["@anolilab/eslint-config"] }.`),Promise.resolve()):p(t,f,"utf-8")},d=()=>{let t=path.join(packageJsonUtils.projectPath,".eslintignore");return fs.existsSync(t)?(console.warn("\u26A0\uFE0F .eslintignore already exists"),Promise.resolve()):p(t,"","utf-8")};(async()=>{try{await Promise.all([h(),d()]),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(t){console.log("\u{1F62C} something went wrong:"),console.error(t),process.exit(1);}})();
63
+ `;return f(t,m,"utf8")},w=()=>{let t=path.join(packageJsonUtils.projectPath,".eslintignore");return fs.existsSync(t)?(console.warn("\u26A0\uFE0F .eslintignore already exists"),Promise.resolve()):f(t,"","utf8")};(async()=>{try{await Promise.all([d(),w()]),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(t){console.log("\u{1F62C} something went wrong:"),console.error(t),process.exit(1);}})();
64
64
  //# sourceMappingURL=out.js.map
65
65
  //# sourceMappingURL=postinstall.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","readFileSync","writeFile","join","promisify","writeFileAsync","writeEslintRc","eslintPath","pluginExtends","parserOptions","tsconfigPath","tsConfig","ecmaVersion","content","writeEslintIgnore","eslintIgnorePath","error"],"mappings":"AAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,gBAAAC,EAAc,aAAAC,MAAiB,KACpD,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAGtB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,sCAAuCH,EAAa;AAAA,CAAI,EAMpE,IAAMO,EAAgB,IAAM,CACxB,IAAMC,EAAaJ,EAAKJ,EAAa,cAAc,EAE/CS,EAAgB,GAChBC,EAAgB;AAAA;AAAA;AAAA,sBAGFX,EAAsB,WAAa;AAAA,QAG/CY,EAAeP,EAAKJ,EAAa,eAAe,EAEtD,GAAIC,EAAWU,CAAY,EAAG,CAC1B,IAAMC,EAAW,KAAK,MAAMV,EAAaS,EAAc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AMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, readFileSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport type { TsConfigJson } from \"type-fest\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/eslint-config\", projectPath, \"\\n\");\n\n/**\n * Writes .eslintrc.js if it doesn't exist. Warns if it exists.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeEslintRc = () => {\n const eslintPath = join(projectPath, \".eslintrc.js\");\n\n let pluginExtends = \"\";\n let parserOptions = `\n parserOptions: {\n ecmaVersion: \"latest\",\n sourceType: ${packageIsTypeModule ? '\"module\"' : '\"commonjs\"'},\n },`;\n\n const tsconfigPath = join(projectPath, \"tsconfig.json\");\n\n if (existsSync(tsconfigPath)) {\n const tsConfig = JSON.parse(readFileSync(tsconfigPath, \"utf8\")) as TsConfigJson;\n\n let ecmaVersion = \"latest\";\n\n if (tsConfig.compilerOptions?.target) {\n ecmaVersion = tsConfig.compilerOptions.target;\n\n ecmaVersion = ecmaVersion.toLowerCase() === \"es2022\" || ecmaVersion.toLowerCase() === \"esnext\" ? \"latest\" : ecmaVersion.toLowerCase().replace(\"es\", \"\");\n\n if (ecmaVersion !== \"latest\" && ecmaVersion !== \"2022\" && ecmaVersion !== \"2021\" && ecmaVersion !== \"2021\" && ecmaVersion !== \"6\") {\n pluginExtends = `, \"plugin:es/restrict-to-es${ecmaVersion}\"`;\n }\n }\n\n parserOptions = `\n parserOptions: {\n project: \"./tsconfig.json\",\n ecmaVersion: ${ecmaVersion === \"latest\" ? `\"${ecmaVersion}\"` : ecmaVersion},\n sourceType: ${packageIsTypeModule ? '\"module\"' : '\"commonjs\"'},\n },`;\n }\n\n const content = `/** @ts-check */\n/** @type {import('eslint').Linter.Config} */\n${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n root: true,\n extends: [\"@anolilab/eslint-config\"${pluginExtends}],\n ignorePatterns: [\"!**/*\"],\n env: {\n // Your environments (which contains several predefined global variables)\n // Most environments are loaded automatically if our rules are added\n },${parserOptions}\n globals: {\n // Your global variables (setting to false means it's not allowed to be reassigned)\n // myGlobal: false\n },\n rules: {\n // Customize your rules\n },\n overrides: [\n {\n files: [\n \"*.ts\",\n \"*.tsx\",\n \"*.mts\",\n \"*.cts\",\n \"*.js\",\n \"*.jsx\",\n ],\n // Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting\n parserOptions: {},\n rules: {},\n },\n {\n files: [\"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"],\n // Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting\n parserOptions: {},\n rules: {},\n },\n {\n files: [\"*.js\", \"*.jsx\"],\n rules: {},\n },\n ],\n};\n`;\n\n if (existsSync(eslintPath)) {\n console.warn(`⚠️ .eslintrc.cjs already exists;\nMake sure that it includes the following for @anolilab/eslint-config'\nto work as it should: { extends: [\"@anolilab/eslint-config\"] }.`);\n\n return Promise.resolve();\n }\n\n return writeFileAsync(eslintPath, content, \"utf-8\");\n};\n\n/**\n * Writes .eslintignore if it doesn't exist. Warns if it exists.\n */\nconst writeEslintIgnore = () => {\n const eslintIgnorePath = join(projectPath, \".eslintignore\");\n\n if (existsSync(eslintIgnorePath)) {\n console.warn(\"⚠️ .eslintignore already exists\");\n\n return Promise.resolve();\n }\n\n return writeFileAsync(eslintIgnorePath, \"\", \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n // eslint-disable-next-line compat/compat\n await Promise.all([writeEslintRc(), writeEslintIgnore()]);\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
1
+ {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","readFileSync","writeFile","join","promisify","writeFileAsync","configFile","writeEslintRc","filename","eslintPath","pluginExtends","parserOptions","tsconfigPath","tsConfig","ecmaVersion","content","writeEslintIgnore","eslintIgnorePath","error"],"mappings":"AAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,gBAAAC,EAAc,aAAAC,MAAiB,KACpD,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAGtB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,sCAAuCH,EAAa;AAAA,CAAI,EAEpE,IAAMO,EAAa,YAMbC,EAAgB,IAAM,CAExB,QAAWC,IAAY,CAACF,EAAY,GAAGA,OAAiB,GAAGA,QAAkB,GAAGA,SAAmB,GAAGA,SAAmB,GAAGA,OAAgB,EACxI,GAAIN,EAAWG,EAAKJ,EAAaS,CAAQ,CAAC,EACtC,eAAQ,KAAK,iBAAOA;AAAA;AAAA,gEAEgC,EAE7C,QAAQ,QAAQ,EAI/B,IAAMC,EAAaN,EAAKJ,EAAa,cAAc,EAE/CW,EAAgB,GAChBC,EAAgB;AAAA;AAAA;AAAA,sBAGFb,EAAsB,WAAa;AAAA,QAG/Cc,EAAeT,EAAKJ,EAAa,eAAe,EAEtD,GAAIC,EAAWY,CAAY,EAAG,CAC1B,IAAMC,EAAW,KAAK,MAAMZ,EAAaW,EAAc,MAAM,CAAC,EAE1DE,EAAc,SAEdD,EAAS,iBAAiB,SAC1BC,EAAcD,EAAS,gBAAgB,OAEvCC,EAAcA,EAAY,YAAY,IAAM,UAAYA,EAAY,YAAY,IAAM,SAAW,SAAWA,EAAY,YAAY,EAAE,QAAQ,KAAM,EAAE,EAElJA,IAAgB,UAAYA,IAAgB,QAAUA,IAAgB,QAAUA,IAAgB,MAChGJ,EAAgB,gCAAgCI,OAIxDH,EAAgB;AAAA;AAAA;AAAA,uBAGDG,IAAgB,SAAW,IAAIA,KAAiBA;AAAA,sBACjDhB,EAAsB,WAAa;AAAA,OAErD,CAEA,IAAMiB,EAAU;AAAA;AAAA,EAElBjB,EAAsB,iBAAmB;AAAA;AAAA,yCAEFY;AAAA;AAAA;AAAA;AAAA;AAAA,QAKjCC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoCJ,OAAON,EAAeI,EAAYM,EAAS,MAAM,CACrD,EAKMC,EAAoB,IAAM,CAC5B,IAAMC,EAAmBd,EAAKJ,EAAa,eAAe,EAE1D,OAAIC,EAAWiB,CAAgB,GAC3B,QAAQ,KAAK,4CAAkC,EAExC,QAAQ,QAAQ,GAGpBZ,EAAeY,EAAkB,GAAI,MAAM,CACtD,GAGC,SAAY,CACT,GAAI,CAEA,MAAM,QAAQ,IAAI,CAACV,EAAc,EAAGS,EAAkB,CAAC,CAAC,EAExD,QAAQ,IAAI,4CAAqC,EAGjD,QAAQ,KAAK,CAAC,CAClB,OAASE,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, readFileSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport type { TsConfigJson } from \"type-fest\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/eslint-config\", projectPath, \"\\n\");\n\nconst configFile = \".eslintrc\";\n\n/**\n * Writes .eslintrc.js if it doesn't exist. Warns if it exists.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeEslintRc = () => {\n // eslint-disable-next-line no-restricted-syntax\n for (const filename of [configFile, `${configFile}.js`, `${configFile}.cjs`, `${configFile}.json`, `${configFile}.yaml`, `${configFile}.yml`]) {\n if (existsSync(join(projectPath, filename))) {\n console.warn(`⚠️ ${filename} already exists;\nMake sure that it includes the following for @anolilab/eslint-config'\nto work as it should: { extends: [\"@anolilab/eslint-config\"] }.`);\n\n return Promise.resolve();\n }\n }\n\n const eslintPath = join(projectPath, \".eslintrc.js\");\n\n let pluginExtends = \"\";\n let parserOptions = `\n parserOptions: {\n ecmaVersion: \"latest\",\n sourceType: ${packageIsTypeModule ? '\"module\"' : '\"commonjs\"'},\n },`;\n\n const tsconfigPath = join(projectPath, \"tsconfig.json\");\n\n if (existsSync(tsconfigPath)) {\n const tsConfig = JSON.parse(readFileSync(tsconfigPath, \"utf8\")) as TsConfigJson;\n\n let ecmaVersion = \"latest\";\n\n if (tsConfig.compilerOptions?.target) {\n ecmaVersion = tsConfig.compilerOptions.target;\n\n ecmaVersion = ecmaVersion.toLowerCase() === \"es2022\" || ecmaVersion.toLowerCase() === \"esnext\" ? \"latest\" : ecmaVersion.toLowerCase().replace(\"es\", \"\");\n\n if (ecmaVersion !== \"latest\" && ecmaVersion !== \"2022\" && ecmaVersion !== \"2021\" && ecmaVersion !== \"6\") {\n pluginExtends = `, \"plugin:es-x/restrict-to-es${ecmaVersion}\"`;\n }\n }\n\n parserOptions = `\n parserOptions: {\n project: \"./tsconfig.json\",\n ecmaVersion: ${ecmaVersion === \"latest\" ? `\"${ecmaVersion}\"` : ecmaVersion},\n sourceType: ${packageIsTypeModule ? '\"module\"' : '\"commonjs\"'},\n },`;\n }\n\n const content = `/** @ts-check */\n/** @type {import('eslint').Linter.Config} */\n${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n root: true,\n extends: [\"@anolilab/eslint-config\"${pluginExtends}],\n ignorePatterns: [\"!**/*\"],\n env: {\n // Your environments (which contains several predefined global variables)\n // Most environments are loaded automatically if our rules are added\n },${parserOptions}\n globals: {\n // Your global variables (setting to false means it's not allowed to be reassigned)\n // myGlobal: false\n },\n rules: {\n // Customize your rules\n },\n overrides: [\n {\n files: [\n \"*.ts\",\n \"*.tsx\",\n \"*.mts\",\n \"*.cts\",\n \"*.js\",\n \"*.jsx\",\n ],\n // Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting\n parserOptions: {},\n rules: {},\n },\n {\n files: [\"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"],\n // Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting\n parserOptions: {},\n rules: {},\n },\n {\n files: [\"*.js\", \"*.jsx\"],\n rules: {},\n },\n ],\n};\n`;\n\n return writeFileAsync(eslintPath, content, \"utf8\");\n};\n\n/**\n * Writes .eslintignore if it doesn't exist. Warns if it exists.\n */\nconst writeEslintIgnore = () => {\n const eslintIgnorePath = join(projectPath, \".eslintignore\");\n\n if (existsSync(eslintIgnorePath)) {\n console.warn(\"⚠️ .eslintignore already exists\");\n\n return Promise.resolve();\n }\n\n return writeFileAsync(eslintIgnorePath, \"\", \"utf8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n // eslint-disable-next-line compat/compat\n await Promise.all([writeEslintRc(), writeEslintIgnore()]);\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
@@ -3,26 +3,28 @@ import { writeFile, existsSync, readFileSync } from 'fs';
3
3
  import { join } from 'path';
4
4
  import { promisify } from 'util';
5
5
 
6
- process.env.CI&&process.exit(0);var p=promisify(writeFile);console.log("Configuring @anolilab/eslint-config",projectPath,`
7
- `);var h=()=>{let t=join(projectPath,".eslintrc.js"),i="",l=`
6
+ process.env.CI&&process.exit(0);var f=promisify(writeFile);console.log("Configuring @anolilab/eslint-config",projectPath,`
7
+ `);var s=".eslintrc",d=()=>{for(let o of [s,`${s}.js`,`${s}.cjs`,`${s}.json`,`${s}.yaml`,`${s}.yml`])if(existsSync(join(projectPath,o)))return console.warn(`\u26A0\uFE0F ${o} already exists;
8
+ Make sure that it includes the following for @anolilab/eslint-config'
9
+ to work as it should: { extends: ["@anolilab/eslint-config"] }.`),Promise.resolve();let t=join(projectPath,".eslintrc.js"),a="",c=`
8
10
  parserOptions: {
9
11
  ecmaVersion: "latest",
10
12
  sourceType: ${packageIsTypeModule?'"module"':'"commonjs"'},
11
- },`,a=join(projectPath,"tsconfig.json");if(existsSync(a)){let c=JSON.parse(readFileSync(a,"utf8")),e="latest";c.compilerOptions?.target&&(e=c.compilerOptions.target,e=e.toLowerCase()==="es2022"||e.toLowerCase()==="esnext"?"latest":e.toLowerCase().replace("es",""),e!=="latest"&&e!=="2022"&&e!=="2021"&&e!=="2021"&&e!=="6"&&(i=`, "plugin:es/restrict-to-es${e}"`)),l=`
13
+ },`,p=join(projectPath,"tsconfig.json");if(existsSync(p)){let o=JSON.parse(readFileSync(p,"utf8")),e="latest";o.compilerOptions?.target&&(e=o.compilerOptions.target,e=e.toLowerCase()==="es2022"||e.toLowerCase()==="esnext"?"latest":e.toLowerCase().replace("es",""),e!=="latest"&&e!=="2022"&&e!=="2021"&&e!=="6"&&(a=`, "plugin:es-x/restrict-to-es${e}"`)),c=`
12
14
  parserOptions: {
13
15
  project: "./tsconfig.json",
14
16
  ecmaVersion: ${e==="latest"?`"${e}"`:e},
15
17
  sourceType: ${packageIsTypeModule?'"module"':'"commonjs"'},
16
- },`;}let f=`/** @ts-check */
18
+ },`;}let m=`/** @ts-check */
17
19
  /** @type {import('eslint').Linter.Config} */
18
20
  ${packageIsTypeModule?"export default":"module.exports ="} {
19
21
  root: true,
20
- extends: ["@anolilab/eslint-config"${i}],
22
+ extends: ["@anolilab/eslint-config"${a}],
21
23
  ignorePatterns: ["!**/*"],
22
24
  env: {
23
25
  // Your environments (which contains several predefined global variables)
24
26
  // Most environments are loaded automatically if our rules are added
25
- },${l}
27
+ },${c}
26
28
  globals: {
27
29
  // Your global variables (setting to false means it's not allowed to be reassigned)
28
30
  // myGlobal: false
@@ -56,8 +58,6 @@ ${packageIsTypeModule?"export default":"module.exports ="} {
56
58
  },
57
59
  ],
58
60
  };
59
- `;return existsSync(t)?(console.warn(`\u26A0\uFE0F .eslintrc.cjs already exists;
60
- Make sure that it includes the following for @anolilab/eslint-config'
61
- to work as it should: { extends: ["@anolilab/eslint-config"] }.`),Promise.resolve()):p(t,f,"utf-8")},d=()=>{let t=join(projectPath,".eslintignore");return existsSync(t)?(console.warn("\u26A0\uFE0F .eslintignore already exists"),Promise.resolve()):p(t,"","utf-8")};(async()=>{try{await Promise.all([h(),d()]),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(t){console.log("\u{1F62C} something went wrong:"),console.error(t),process.exit(1);}})();
61
+ `;return f(t,m,"utf8")},w=()=>{let t=join(projectPath,".eslintignore");return existsSync(t)?(console.warn("\u26A0\uFE0F .eslintignore already exists"),Promise.resolve()):f(t,"","utf8")};(async()=>{try{await Promise.all([d(),w()]),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(t){console.log("\u{1F62C} something went wrong:"),console.error(t),process.exit(1);}})();
62
62
  //# sourceMappingURL=out.js.map
63
63
  //# sourceMappingURL=postinstall.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","readFileSync","writeFile","join","promisify","writeFileAsync","writeEslintRc","eslintPath","pluginExtends","parserOptions","tsconfigPath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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoCJ,OAAIT,EAAWO,CAAU,GACrB,QAAQ,KAAK;AAAA;AAAA,gEAE2C,EAEjD,QAAQ,QAAQ,GAGpBF,EAAeE,EAAYM,EAAS,OAAO,CACtD,EAKMC,EAAoB,IAAM,CAC5B,IAAMC,EAAmBZ,EAAKJ,EAAa,eAAe,EAE1D,OAAIC,EAAWe,CAAgB,GAC3B,QAAQ,KAAK,4CAAkC,EAExC,QAAQ,QAAQ,GAGpBV,EAAeU,EAAkB,GAAI,OAAO,CACvD,GAGC,SAAY,CACT,GAAI,CAEA,MAAM,QAAQ,IAAI,CAACT,EAAc,EAAGQ,EAAkB,CAAC,CAAC,EAExD,QAAQ,IAAI,4CAAqC,EAGjD,QAAQ,KAAK,CAAC,CAClB,OAASE,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, readFileSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport type { TsConfigJson } from \"type-fest\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/eslint-config\", projectPath, \"\\n\");\n\n/**\n * Writes .eslintrc.js if it doesn't exist. Warns if it exists.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeEslintRc = () => {\n const eslintPath = join(projectPath, \".eslintrc.js\");\n\n let pluginExtends = \"\";\n let parserOptions = `\n parserOptions: {\n ecmaVersion: \"latest\",\n sourceType: ${packageIsTypeModule ? '\"module\"' : '\"commonjs\"'},\n },`;\n\n const tsconfigPath = join(projectPath, \"tsconfig.json\");\n\n if (existsSync(tsconfigPath)) {\n const tsConfig = JSON.parse(readFileSync(tsconfigPath, \"utf8\")) as TsConfigJson;\n\n let ecmaVersion = \"latest\";\n\n if (tsConfig.compilerOptions?.target) {\n ecmaVersion = tsConfig.compilerOptions.target;\n\n ecmaVersion = ecmaVersion.toLowerCase() === \"es2022\" || ecmaVersion.toLowerCase() === \"esnext\" ? \"latest\" : ecmaVersion.toLowerCase().replace(\"es\", \"\");\n\n if (ecmaVersion !== \"latest\" && ecmaVersion !== \"2022\" && ecmaVersion !== \"2021\" && ecmaVersion !== \"2021\" && ecmaVersion !== \"6\") {\n pluginExtends = `, \"plugin:es/restrict-to-es${ecmaVersion}\"`;\n }\n }\n\n parserOptions = `\n parserOptions: {\n project: \"./tsconfig.json\",\n ecmaVersion: ${ecmaVersion === \"latest\" ? `\"${ecmaVersion}\"` : ecmaVersion},\n sourceType: ${packageIsTypeModule ? '\"module\"' : '\"commonjs\"'},\n },`;\n }\n\n const content = `/** @ts-check */\n/** @type {import('eslint').Linter.Config} */\n${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n root: true,\n extends: [\"@anolilab/eslint-config\"${pluginExtends}],\n ignorePatterns: [\"!**/*\"],\n env: {\n // Your environments (which contains several predefined global variables)\n // Most environments are loaded automatically if our rules are added\n },${parserOptions}\n globals: {\n // Your global variables (setting to false means it's not allowed to be reassigned)\n // myGlobal: false\n },\n rules: {\n // Customize your rules\n },\n overrides: [\n {\n files: [\n \"*.ts\",\n \"*.tsx\",\n \"*.mts\",\n \"*.cts\",\n \"*.js\",\n \"*.jsx\",\n ],\n // Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting\n parserOptions: {},\n rules: {},\n },\n {\n files: [\"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"],\n // Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting\n parserOptions: {},\n rules: {},\n },\n {\n files: [\"*.js\", \"*.jsx\"],\n rules: {},\n },\n ],\n};\n`;\n\n if (existsSync(eslintPath)) {\n console.warn(`⚠️ .eslintrc.cjs already exists;\nMake sure that it includes the following for @anolilab/eslint-config'\nto work as it should: { extends: [\"@anolilab/eslint-config\"] }.`);\n\n return Promise.resolve();\n }\n\n return writeFileAsync(eslintPath, content, \"utf-8\");\n};\n\n/**\n * Writes .eslintignore if it doesn't exist. Warns if it exists.\n */\nconst writeEslintIgnore = () => {\n const eslintIgnorePath = join(projectPath, \".eslintignore\");\n\n if (existsSync(eslintIgnorePath)) {\n console.warn(\"⚠️ .eslintignore already exists\");\n\n return Promise.resolve();\n }\n\n return writeFileAsync(eslintIgnorePath, \"\", \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n // eslint-disable-next-line compat/compat\n await Promise.all([writeEslintRc(), writeEslintIgnore()]);\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
1
+ {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","readFileSync","writeFile","join","promisify","writeFileAsync","configFile","writeEslintRc","filename","eslintPath","pluginExtends","parserOptions","tsconfigPath","tsConfig","ecmaVersion","content","writeEslintIgnore","eslintIgnorePath","error"],"mappings":"AAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,gBAAAC,EAAc,aAAAC,MAAiB,KACpD,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAGtB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,sCAAuCH,EAAa;AAAA,CAAI,EAEpE,IAAMO,EAAa,YAMbC,EAAgB,IAAM,CAExB,QAAWC,IAAY,CAACF,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J,EAAa,eAAe,EAE1D,OAAIC,EAAWiB,CAAgB,GAC3B,QAAQ,KAAK,4CAAkC,EAExC,QAAQ,QAAQ,GAGpBZ,EAAeY,EAAkB,GAAI,MAAM,CACtD,GAGC,SAAY,CACT,GAAI,CAEA,MAAM,QAAQ,IAAI,CAACV,EAAc,EAAGS,EAAkB,CAAC,CAAC,EAExD,QAAQ,IAAI,4CAAqC,EAGjD,QAAQ,KAAK,CAAC,CAClB,OAASE,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, readFileSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport type { TsConfigJson } from \"type-fest\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/eslint-config\", projectPath, \"\\n\");\n\nconst configFile = \".eslintrc\";\n\n/**\n * Writes .eslintrc.js if it doesn't exist. Warns if it exists.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeEslintRc = () => {\n // eslint-disable-next-line no-restricted-syntax\n for (const filename of [configFile, `${configFile}.js`, `${configFile}.cjs`, `${configFile}.json`, `${configFile}.yaml`, `${configFile}.yml`]) {\n if (existsSync(join(projectPath, filename))) {\n console.warn(`⚠️ ${filename} already exists;\nMake sure that it includes the following for @anolilab/eslint-config'\nto work as it should: { extends: [\"@anolilab/eslint-config\"] }.`);\n\n return Promise.resolve();\n }\n }\n\n const eslintPath = join(projectPath, \".eslintrc.js\");\n\n let pluginExtends = \"\";\n let parserOptions = `\n parserOptions: {\n ecmaVersion: \"latest\",\n sourceType: ${packageIsTypeModule ? '\"module\"' : '\"commonjs\"'},\n },`;\n\n const tsconfigPath = join(projectPath, \"tsconfig.json\");\n\n if (existsSync(tsconfigPath)) {\n const tsConfig = JSON.parse(readFileSync(tsconfigPath, \"utf8\")) as TsConfigJson;\n\n let ecmaVersion = \"latest\";\n\n if (tsConfig.compilerOptions?.target) {\n ecmaVersion = tsConfig.compilerOptions.target;\n\n ecmaVersion = ecmaVersion.toLowerCase() === \"es2022\" || ecmaVersion.toLowerCase() === \"esnext\" ? \"latest\" : ecmaVersion.toLowerCase().replace(\"es\", \"\");\n\n if (ecmaVersion !== \"latest\" && ecmaVersion !== \"2022\" && ecmaVersion !== \"2021\" && ecmaVersion !== \"6\") {\n pluginExtends = `, \"plugin:es-x/restrict-to-es${ecmaVersion}\"`;\n }\n }\n\n parserOptions = `\n parserOptions: {\n project: \"./tsconfig.json\",\n ecmaVersion: ${ecmaVersion === \"latest\" ? `\"${ecmaVersion}\"` : ecmaVersion},\n sourceType: ${packageIsTypeModule ? '\"module\"' : '\"commonjs\"'},\n },`;\n }\n\n const content = `/** @ts-check */\n/** @type {import('eslint').Linter.Config} */\n${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n root: true,\n extends: [\"@anolilab/eslint-config\"${pluginExtends}],\n ignorePatterns: [\"!**/*\"],\n env: {\n // Your environments (which contains several predefined global variables)\n // Most environments are loaded automatically if our rules are added\n },${parserOptions}\n globals: {\n // Your global variables (setting to false means it's not allowed to be reassigned)\n // myGlobal: false\n },\n rules: {\n // Customize your rules\n },\n overrides: [\n {\n files: [\n \"*.ts\",\n \"*.tsx\",\n \"*.mts\",\n \"*.cts\",\n \"*.js\",\n \"*.jsx\",\n ],\n // Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting\n parserOptions: {},\n rules: {},\n },\n {\n files: [\"*.ts\", \"*.tsx\", \"*.mts\", \"*.cts\"],\n // Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting\n parserOptions: {},\n rules: {},\n },\n {\n files: [\"*.js\", \"*.jsx\"],\n rules: {},\n },\n ],\n};\n`;\n\n return writeFileAsync(eslintPath, content, \"utf8\");\n};\n\n/**\n * Writes .eslintignore if it doesn't exist. Warns if it exists.\n */\nconst writeEslintIgnore = () => {\n const eslintIgnorePath = join(projectPath, \".eslintignore\");\n\n if (existsSync(eslintIgnorePath)) {\n console.warn(\"⚠️ .eslintignore already exists\");\n\n return Promise.resolve();\n }\n\n return writeFileAsync(eslintIgnorePath, \"\", \"utf8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n // eslint-disable-next-line compat/compat\n await Promise.all([writeEslintRc(), writeEslintIgnore()]);\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anolilab/eslint-config",
3
- "version": "7.2.0",
3
+ "version": "7.2.2",
4
4
  "description": "ESLint shareable config for the Anolilab JavaScript style guide.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -125,7 +125,7 @@
125
125
  "eslint-import-resolver-typescript": "^3.5.5",
126
126
  "eslint-plugin-antfu": "^0.39.5",
127
127
  "eslint-plugin-compat": "^4.1.4",
128
- "eslint-plugin-es": "^4.1.0",
128
+ "eslint-plugin-es-x": "^7.1.0",
129
129
  "eslint-plugin-eslint-comments": "^3.2.0",
130
130
  "eslint-plugin-html": "^7.1.0",
131
131
  "eslint-plugin-i": "^2.27.5",