@abinnovision/eslint-config-base 1.2.0 → 2.1.0

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,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.0](https://github.com/abinnovision/js-commons/compare/eslint-config-base-v2.0.0...eslint-config-base-v2.1.0) (2024-08-05)
4
+
5
+
6
+ ### Features
7
+
8
+ * migrate to esm ([#278](https://github.com/abinnovision/js-commons/issues/278)) ([fed850d](https://github.com/abinnovision/js-commons/commit/fed850d979f7ba83fae75adadcfd0024f2acd242))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * wrap eslint-plugin-import with compat package ([#280](https://github.com/abinnovision/js-commons/issues/280)) ([2f61aca](https://github.com/abinnovision/js-commons/commit/2f61aca45ccfb248868815906d87d4be6656dcf5))
14
+
15
+ ## [2.0.0](https://github.com/abinnovision/js-commons/compare/eslint-config-base-v1.2.0...eslint-config-base-v2.0.0) (2023-11-03)
16
+
17
+
18
+ ### ⚠ BREAKING CHANGES
19
+
20
+ * will drop support for legacy eslint configs
21
+
22
+ ### Features
23
+
24
+ * enable new ESLint rules ([#104](https://github.com/abinnovision/js-commons/issues/104)) ([ffac1dc](https://github.com/abinnovision/js-commons/commit/ffac1dc4bc2c6794c2f7d1bd1ec72542e20cd06d))
25
+ * migrate to eslint flat config ([#93](https://github.com/abinnovision/js-commons/issues/93)) ([7568ba1](https://github.com/abinnovision/js-commons/commit/7568ba1782f912357e18619ab3e4e56a0c738a1c))
26
+
3
27
  ## [1.2.0](https://github.com/abinnovision/js-commons/compare/eslint-config-base-v1.1.0...eslint-config-base-v1.2.0) (2023-10-28)
4
28
 
5
29
 
package/README.md CHANGED
@@ -1,23 +1,13 @@
1
1
  # @abinnovision/eslint-config-base
2
2
 
3
3
  Base ESLint config, which can be used with Javascript only if applied
4
- standalone. This config is based on
4
+ standalone.
5
+ This config is based on
5
6
  the [AlloyTeam ESLint Config](https://github.com/AlloyTeam/eslint-config-alloy)
6
7
  with some additional goodies on top.
7
8
 
8
9
  ## Installation
9
10
 
10
11
  ```shell
11
- yarn add --dev \
12
- # This config itself.
13
- @abinnovision/eslint-config-base \
14
- # Required configs/plugins by this config.
15
- eslint eslint-plugin-import
12
+ yarn add --dev @abinnovision/eslint-config-base
16
13
  ```
17
-
18
- ## Dependencies
19
-
20
- This config requires the following dependencies (defined as peer dependencies):
21
-
22
- - [eslint](https://www.npmjs.com/package/eslint)
23
- - [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)
package/dist/index.cjs ADDED
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ default: () => src_default
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+ var import_compat = require("@eslint/compat");
37
+ var import_base = __toESM(require("eslint-config-alloy/base.js"), 1);
38
+ var import_eslint_plugin_import = __toESM(require("eslint-plugin-import"), 1);
39
+ var config = [
40
+ {
41
+ files: ["**/*.{ts,tsx,js,jsx}"],
42
+ languageOptions: {
43
+ ecmaVersion: "latest"
44
+ },
45
+ plugins: {
46
+ /**
47
+ * eslint-plugin-import is not yet compatible with ESLint v9.
48
+ * This is a temporary fix to make it compatible in the meantime.
49
+ *
50
+ * @see https://github.com/import-js/eslint-plugin-import/issues/2948
51
+ */
52
+ import: (0, import_compat.fixupPluginRules)(import_eslint_plugin_import.default)
53
+ },
54
+ rules: {
55
+ /**
56
+ * Use the rules from the base config as defaults.
57
+ *
58
+ * @see https://alloyteam.github.io/eslint-config-alloy/?hideOff=1
59
+ */
60
+ ...import_base.default.rules ?? {},
61
+ /**
62
+ * Enforce a consistent order and grouping of import statements.
63
+ *
64
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
65
+ */
66
+ "import/order": [
67
+ "error",
68
+ {
69
+ groups: [
70
+ // Externals
71
+ ["builtin", "external"],
72
+ // Internals
73
+ ["internal", "unknown", "parent", "sibling", "index"],
74
+ // Types
75
+ ["object", "type"]
76
+ ],
77
+ "newlines-between": "always",
78
+ alphabetize: { order: "asc", caseInsensitive: true },
79
+ warnOnUnassignedImports: true
80
+ }
81
+ ],
82
+ /**
83
+ * Enforce the "export" statement is placed at the end of the file.
84
+ * This avoids sprinkling export statements throughout the file.
85
+ *
86
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/exports-last.md
87
+ */
88
+ "import/exports-last": "warn",
89
+ /**
90
+ * Import statements should always be the first statements in a file.
91
+ * This makes it easier to identify the dependencies of a file.
92
+ *
93
+ * NOTE: Directives (e.g. "use strict") are allowed to come before import statements.
94
+ *
95
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
96
+ */
97
+ "import/first": "error",
98
+ /**
99
+ * Enforce a newline after the import statements.
100
+ *
101
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
102
+ */
103
+ "import/newline-after-import": "error",
104
+ /**
105
+ * Disable the "no-return-await" rule.
106
+ */
107
+ "no-return-await": "off"
108
+ }
109
+ }
110
+ ];
111
+ var src_default = config;
@@ -0,0 +1,61 @@
1
+ import * as eslint from 'eslint';
2
+
3
+ declare const config: {
4
+ files: string[];
5
+ languageOptions: {
6
+ ecmaVersion: "latest";
7
+ };
8
+ plugins: {
9
+ /**
10
+ * eslint-plugin-import is not yet compatible with ESLint v9.
11
+ * This is a temporary fix to make it compatible in the meantime.
12
+ *
13
+ * @see https://github.com/import-js/eslint-plugin-import/issues/2948
14
+ */
15
+ import: eslint.ESLint.Plugin;
16
+ };
17
+ rules: {
18
+ /**
19
+ * Enforce a consistent order and grouping of import statements.
20
+ *
21
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
22
+ */
23
+ "import/order": ["error", {
24
+ groups: string[][];
25
+ "newlines-between": string;
26
+ alphabetize: {
27
+ order: string;
28
+ caseInsensitive: boolean;
29
+ };
30
+ warnOnUnassignedImports: boolean;
31
+ }];
32
+ /**
33
+ * Enforce the "export" statement is placed at the end of the file.
34
+ * This avoids sprinkling export statements throughout the file.
35
+ *
36
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/exports-last.md
37
+ */
38
+ "import/exports-last": "warn";
39
+ /**
40
+ * Import statements should always be the first statements in a file.
41
+ * This makes it easier to identify the dependencies of a file.
42
+ *
43
+ * NOTE: Directives (e.g. "use strict") are allowed to come before import statements.
44
+ *
45
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
46
+ */
47
+ "import/first": "error";
48
+ /**
49
+ * Enforce a newline after the import statements.
50
+ *
51
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
52
+ */
53
+ "import/newline-after-import": "error";
54
+ /**
55
+ * Disable the "no-return-await" rule.
56
+ */
57
+ "no-return-await": "off";
58
+ };
59
+ }[];
60
+
61
+ export { config as default };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,61 @@
1
- import type { Linter } from "eslint";
2
- import type { ESLintRules } from "eslint/rules";
3
- declare const config: Linter.BaseConfig<ESLintRules>;
4
- export = config;
1
+ import * as eslint from 'eslint';
2
+
3
+ declare const config: {
4
+ files: string[];
5
+ languageOptions: {
6
+ ecmaVersion: "latest";
7
+ };
8
+ plugins: {
9
+ /**
10
+ * eslint-plugin-import is not yet compatible with ESLint v9.
11
+ * This is a temporary fix to make it compatible in the meantime.
12
+ *
13
+ * @see https://github.com/import-js/eslint-plugin-import/issues/2948
14
+ */
15
+ import: eslint.ESLint.Plugin;
16
+ };
17
+ rules: {
18
+ /**
19
+ * Enforce a consistent order and grouping of import statements.
20
+ *
21
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
22
+ */
23
+ "import/order": ["error", {
24
+ groups: string[][];
25
+ "newlines-between": string;
26
+ alphabetize: {
27
+ order: string;
28
+ caseInsensitive: boolean;
29
+ };
30
+ warnOnUnassignedImports: boolean;
31
+ }];
32
+ /**
33
+ * Enforce the "export" statement is placed at the end of the file.
34
+ * This avoids sprinkling export statements throughout the file.
35
+ *
36
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/exports-last.md
37
+ */
38
+ "import/exports-last": "warn";
39
+ /**
40
+ * Import statements should always be the first statements in a file.
41
+ * This makes it easier to identify the dependencies of a file.
42
+ *
43
+ * NOTE: Directives (e.g. "use strict") are allowed to come before import statements.
44
+ *
45
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
46
+ */
47
+ "import/first": "error";
48
+ /**
49
+ * Enforce a newline after the import statements.
50
+ *
51
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
52
+ */
53
+ "import/newline-after-import": "error";
54
+ /**
55
+ * Disable the "no-return-await" rule.
56
+ */
57
+ "no-return-await": "off";
58
+ };
59
+ }[];
60
+
61
+ export { config as default };
package/dist/index.js CHANGED
@@ -1,40 +1,80 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var _a;
14
- var AlloyBase = require("eslint-config-alloy/base");
15
- var config = {
16
- parserOptions: {
17
- ecmaVersion: "latest",
1
+ // src/index.ts
2
+ import { fixupPluginRules } from "@eslint/compat";
3
+ import AlloyBase from "eslint-config-alloy/base.js";
4
+ import eslintPluginImport from "eslint-plugin-import";
5
+ var config = [
6
+ {
7
+ files: ["**/*.{ts,tsx,js,jsx}"],
8
+ languageOptions: {
9
+ ecmaVersion: "latest"
18
10
  },
19
- env: {
20
- browser: true,
21
- node: true,
22
- commonjs: true,
23
- es6: true,
11
+ plugins: {
12
+ /**
13
+ * eslint-plugin-import is not yet compatible with ESLint v9.
14
+ * This is a temporary fix to make it compatible in the meantime.
15
+ *
16
+ * @see https://github.com/import-js/eslint-plugin-import/issues/2948
17
+ */
18
+ import: fixupPluginRules(eslintPluginImport)
24
19
  },
25
- plugins: ["import"],
26
- rules: __assign(__assign({}, ((_a = AlloyBase.rules) !== null && _a !== void 0 ? _a : {})), { "import/order": [
27
- "error",
28
- {
29
- groups: [
30
- ["builtin", "external"],
31
- ["internal", "unknown", "parent", "sibling", "index"],
32
- ["object", "type"],
33
- ],
34
- "newlines-between": "always",
35
- alphabetize: { order: "asc", caseInsensitive: true },
36
- warnOnUnassignedImports: true,
37
- },
38
- ] }),
20
+ rules: {
21
+ /**
22
+ * Use the rules from the base config as defaults.
23
+ *
24
+ * @see https://alloyteam.github.io/eslint-config-alloy/?hideOff=1
25
+ */
26
+ ...AlloyBase.rules ?? {},
27
+ /**
28
+ * Enforce a consistent order and grouping of import statements.
29
+ *
30
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
31
+ */
32
+ "import/order": [
33
+ "error",
34
+ {
35
+ groups: [
36
+ // Externals
37
+ ["builtin", "external"],
38
+ // Internals
39
+ ["internal", "unknown", "parent", "sibling", "index"],
40
+ // Types
41
+ ["object", "type"]
42
+ ],
43
+ "newlines-between": "always",
44
+ alphabetize: { order: "asc", caseInsensitive: true },
45
+ warnOnUnassignedImports: true
46
+ }
47
+ ],
48
+ /**
49
+ * Enforce the "export" statement is placed at the end of the file.
50
+ * This avoids sprinkling export statements throughout the file.
51
+ *
52
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/exports-last.md
53
+ */
54
+ "import/exports-last": "warn",
55
+ /**
56
+ * Import statements should always be the first statements in a file.
57
+ * This makes it easier to identify the dependencies of a file.
58
+ *
59
+ * NOTE: Directives (e.g. "use strict") are allowed to come before import statements.
60
+ *
61
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
62
+ */
63
+ "import/first": "error",
64
+ /**
65
+ * Enforce a newline after the import statements.
66
+ *
67
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
68
+ */
69
+ "import/newline-after-import": "error",
70
+ /**
71
+ * Disable the "no-return-await" rule.
72
+ */
73
+ "no-return-await": "off"
74
+ }
75
+ }
76
+ ];
77
+ var src_default = config;
78
+ export {
79
+ src_default as default
39
80
  };
40
- module.exports = config;
package/package.json CHANGED
@@ -1,63 +1,61 @@
1
1
  {
2
2
  "name": "@abinnovision/eslint-config-base",
3
- "packageManager": "yarn@3.4.1",
4
- "version": "1.2.0",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
3
+ "version": "2.1.0",
4
+ "type": "module",
5
+ "repository": {
6
+ "url": "https://github.com/abinnovision/js-commons"
7
+ },
7
8
  "license": "Apache-2.0",
8
9
  "author": {
9
- "name": "AB INNOVISION UG (limited liability)",
10
+ "name": "AB INNOVISION GmbH",
10
11
  "email": "info@abinnovision.com",
11
12
  "url": "https://abinnovision.com/"
12
13
  },
13
- "repository": {
14
- "url": "https://github.com/abinnovision/js-commons"
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs",
18
+ "types": "./dist/index.d.ts"
19
+ }
15
20
  },
21
+ "main": "./dist/index.cjs",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
16
24
  "files": [
17
25
  "dist/"
18
26
  ],
19
27
  "scripts": {
20
- "build": "tsc",
21
- "lint:check": "eslint 'src/**/*.{ts,js}'",
22
- "lint:fix": "eslint --fix 'src/**/*.{ts,js}'",
28
+ "build": "tsup src/index.ts --dts --format esm,cjs --clean",
23
29
  "format:check": "prettier --check 'src/**/*.{ts,js}' '**/*.{md,json,json5,yaml,yml}'",
24
- "format:fix": "prettier --write 'src/**/*.{ts,js}' '**/*.{md,json,json5,yaml,yml}'"
25
- },
26
- "dependencies": {
27
- "eslint-config-alloy": "^5.1.2"
28
- },
29
- "devDependencies": {
30
- "@abinnovision/eslint-config-typescript": "^1.2.0",
31
- "@abinnovision/prettier-config": "^1.1.0",
32
- "@types/eslint": "^8.21.1",
33
- "@typescript-eslint/eslint-plugin": "^6.9.0",
34
- "@typescript-eslint/parser": "^6.9.0",
35
- "eslint": "^8.52.0",
36
- "eslint-plugin-import": "^2.29.0",
37
- "prettier": "^3.0.3",
38
- "typescript": "^5.2.2"
39
- },
40
- "eslintConfig": {
41
- "extends": [
42
- "./dist/index.js",
43
- "@abinnovision/eslint-config-typescript"
44
- ],
45
- "parserOptions": {
46
- "project": "./tsconfig.json"
47
- }
48
- },
49
- "peerDependencies": {
50
- "eslint": "^8.24.0",
51
- "eslint-plugin-import": "^2.0.0"
30
+ "format:fix": "prettier --write 'src/**/*.{ts,js}' '**/*.{md,json,json5,yaml,yml}'",
31
+ "lint:check": "eslint 'src/**/*.{ts,js}'",
32
+ "lint:fix": "eslint --fix 'src/**/*.{ts,js}'"
52
33
  },
53
- "prettier": "@abinnovision/prettier-config",
54
34
  "lint-staged": {
55
35
  "src/**/*.{ts,js}": [
56
36
  "prettier --write",
57
37
  "eslint --fix"
58
38
  ],
59
- "**/*.{md,json,json5,yaml,yml}": [
39
+ "{**/*,*}.{md,json,json5,yaml,yml}": [
60
40
  "prettier --write"
61
41
  ]
62
- }
42
+ },
43
+ "prettier": "@abinnovision/prettier-config",
44
+ "dependencies": {
45
+ "@eslint/compat": "^1.1.1",
46
+ "eslint-config-alloy": "^5.1.2",
47
+ "eslint-plugin-import": "^2.29.1"
48
+ },
49
+ "devDependencies": {
50
+ "@abinnovision/prettier-config": "^2.1.0",
51
+ "@types/eslint": "^9.6.0",
52
+ "eslint": "^9.8.0",
53
+ "globals": "^15.9.0",
54
+ "prettier": "^3.3.3",
55
+ "tsup": "^8.2.4"
56
+ },
57
+ "peerDependencies": {
58
+ "eslint": "^8.24.0 || ^9.0.0"
59
+ },
60
+ "packageManager": "yarn@3.4.1"
63
61
  }