@agilebot/eslint-config 0.7.1 → 0.7.3

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/README.md CHANGED
@@ -2,16 +2,116 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@agilebot/eslint-config?color=444&label=)](https://npmjs.com/package/@agilebot/eslint-config)
4
4
 
5
- ### Usage
5
+ ## Usage
6
+
7
+ ### Manual Install
6
8
 
7
9
  ```bash
8
10
  npm install --save-dev eslint \
9
11
  @agilebot/eslint-config
10
12
  ```
11
13
 
14
+ And create `eslint.config.mjs` in your project root:
15
+
16
+ ```js
17
+ // eslint.config.mjs
18
+ import { agilebot } from '@agilebot/eslint-config';
19
+
20
+ export default agilebot(import.meta);
21
+ ```
22
+
23
+ ## Customization
24
+
25
+ The `agilebot` preset provides a streamlined way to configure your ESLint setup. Here’s how you can use it and customize it based on your needs.
26
+
27
+ ### Basic Usage
28
+
29
+ To get started, import the `agilebot` preset:
30
+
12
31
  ```js
13
- // eslint.config.js
14
- const { agilebot } = require('@agilebot/eslint-config');
32
+ // eslint.config.mjs
33
+ import { agilebot } from '@agilebot/eslint-config';
34
+
35
+ export default agilebot(import.meta);
36
+ ```
37
+
38
+ This will automatically apply the default configurations provided by `agilebot`.
39
+
40
+ ### Advanced Customization
41
+
42
+ If you want more control, you can customize individual integrations using the `FactoryOptions` interface. For example:
43
+
44
+ ```js
45
+ // eslint.config.mjs
46
+ import { agilebot } from '@agilebot/eslint-config';
47
+
48
+ export default agilebot(import.meta, {
49
+ // Replace `.eslintignore` with the `ignores` option
50
+ ignores: [
51
+ '**/fixtures'
52
+ // Add more glob patterns as needed
53
+ ],
54
+
55
+ // List of files or directories where development dependencies are allowed
56
+ // Accepts glob patterns, e.g., '**/scripts/**', '**/test/**'
57
+ devDependencies: ['**/scripts/**', '**/test/**'],
58
+
59
+ // List of modules to be treated as built-in
60
+ // Accepts an array of module names, e.g., ['electron']
61
+ coreModules: ['electron'],
62
+
63
+ // Enable React-specific linting rules
64
+ // Accepts `true`, `false`, or a specific version string, e.g., '17.0.0'
65
+ react: true,
66
+
67
+ // Specify the Vue.js version for linting
68
+ // Accepts a number, e.g., 2 or 3
69
+ vue: 3,
70
+
71
+ // Enable imports-related configurations
72
+ import: true,
73
+
74
+ // Specify the import resolver to use
75
+ // Accepts 'typescript' or 'oxc'
76
+ importResolver: 'typescript',
77
+
78
+ // Enable Lodash-specific linting rules
79
+ // Accepts `true` or `false`
80
+ lodash: true,
81
+
82
+ // Enable Prettier for code formatting
83
+ // Accepts `true` or `false`
84
+ prettier: true,
85
+
86
+ // Enable or disable JSDoc linting rules
87
+ // Accepts `true` or `false`
88
+ jsdoc: false,
89
+
90
+ // Enable ES module linting rules
91
+ // Accepts `true` or `false`
92
+ module: true,
93
+
94
+ // Apply specific monorepo configurations
95
+ // Accepts a string representing the monorepo scope, e.g., '@my-app'
96
+ monorepoScope: '@my-app',
97
+
98
+ // Custom spelling configurations for CSpell
99
+ // Accepts a configuration object or `false` to disable CSpell
100
+ cspell: {
101
+ words: ['agilebot', 'eslint'],
102
+ ignorePaths: ['**/node_modules']
103
+ },
104
+
105
+ // Enable GoDaddy-specific linting configurations
106
+ // Accepts `true`, `false`, or 'typescript' for TypeScript-specific rules
107
+ godaddy: 'typescript',
15
108
 
16
- module.exports = agilebot(__dirname);
109
+ // Custom ESLint configuration to override or extend defaults
110
+ config: {
111
+ rules: {
112
+ 'no-console': 'warn',
113
+ 'prefer-const': 'error'
114
+ }
115
+ }
116
+ });
17
117
  ```
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @agilebot/eslint-config v0.7.1
2
+ * @license @agilebot/eslint-config v0.7.3
3
3
  *
4
4
  * Copyright (c) Agilebot, Inc. and its affiliates.
5
5
  *
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @agilebot/eslint-config v0.7.1
2
+ * @license @agilebot/eslint-config v0.7.3
3
3
  *
4
4
  * Copyright (c) Agilebot, Inc. and its affiliates.
5
5
  *
@@ -52,6 +52,17 @@ var CLI_NAME = "eslint-agilebot";
52
52
 
53
53
  // src/cli/stages/eslint.ts
54
54
  var import_node_path = __toESM(require("path"));
55
+ function patch() {
56
+ if (console?.error) {
57
+ const origConsoleError = console.error;
58
+ console.error = (...args) => {
59
+ if (args?.[0]?.includes("React version not specified")) {
60
+ return;
61
+ }
62
+ origConsoleError(...args);
63
+ };
64
+ }
65
+ }
55
66
  function runBinary() {
56
67
  const pkg = require.resolve("eslint/package.json");
57
68
  const bin = import_node_path.default.join(pkg, "..", "bin", "eslint.js");
@@ -60,6 +71,7 @@ function runBinary() {
60
71
 
61
72
  // src/cli/index.ts
62
73
  function cli() {
74
+ patch();
63
75
  const argv = (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).scriptName(CLI_NAME).usage(`${CLI_NAME} [options] file.js [file.js] [dir]`).options({
64
76
  config: {
65
77
  alias: "c",
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @agilebot/eslint-config v0.7.1
2
+ * @license @agilebot/eslint-config v0.7.3
3
3
  *
4
4
  * Copyright (c) Agilebot, Inc. and its affiliates.
5
5
  *
@@ -10,7 +10,7 @@
10
10
  import {
11
11
  CLI_NAME,
12
12
  __require
13
- } from "./chunk-MQP5VK72.mjs";
13
+ } from "./chunk-CGJVNMKG.mjs";
14
14
 
15
15
  // src/cli/index.ts
16
16
  import { isCI } from "@agilebot/eslint-utils";
@@ -20,6 +20,17 @@ import pc from "picocolors";
20
20
 
21
21
  // src/cli/stages/eslint.ts
22
22
  import path from "node:path";
23
+ function patch() {
24
+ if (console?.error) {
25
+ const origConsoleError = console.error;
26
+ console.error = (...args) => {
27
+ if (args?.[0]?.includes("React version not specified")) {
28
+ return;
29
+ }
30
+ origConsoleError(...args);
31
+ };
32
+ }
33
+ }
23
34
  function runBinary() {
24
35
  const pkg = __require.resolve("eslint/package.json");
25
36
  const bin = path.join(pkg, "..", "bin", "eslint.js");
@@ -28,6 +39,7 @@ function runBinary() {
28
39
 
29
40
  // src/cli/index.ts
30
41
  function cli() {
42
+ patch();
31
43
  const argv = yargs(hideBin(process.argv)).scriptName(CLI_NAME).usage(`${CLI_NAME} [options] file.js [file.js] [dir]`).options({
32
44
  config: {
33
45
  alias: "c",
package/dist/index.d.mts CHANGED
@@ -11,7 +11,7 @@ type Options = Options$1['cspell'];
11
11
 
12
12
  interface FactoryOptions {
13
13
  /**
14
- * ESLint configuration
14
+ * Custom ESLint configuration to override or extend defaults
15
15
  * @default undefined
16
16
  */
17
17
  config?: Omit<FlatConfigItem, 'name' | 'files'>;
@@ -21,62 +21,62 @@ interface FactoryOptions {
21
21
  */
22
22
  ignores?: string[];
23
23
  /**
24
- * List of development dependencies
24
+ * List of files or directories where development dependencies are allowed
25
25
  * @default undefined
26
26
  */
27
27
  devDependencies?: string[];
28
28
  /**
29
- * List of core modules
29
+ * List of modules to be treated as built-in
30
30
  * @default undefined
31
31
  */
32
32
  coreModules?: string[];
33
33
  /**
34
- * Monorepo scope
34
+ * Specific monorepo scope to apply configurations for
35
35
  * @default undefined
36
36
  */
37
37
  monorepoScope?: string;
38
38
  /**
39
- * Flag indicating whether to enable React configurations
39
+ * Enable React-specific linting rules
40
40
  * @default undefined
41
41
  */
42
42
  react?: boolean | string;
43
43
  /**
44
- * Version of Vue.js (optional)
44
+ * Specify the Vue.js version for linting
45
45
  * @default undefined
46
46
  */
47
47
  vue?: number;
48
48
  /**
49
- * Flag indicating whether ES modules are used
49
+ * Enable ES module linting rules
50
50
  * @default undefined
51
51
  */
52
52
  module?: boolean;
53
53
  /**
54
- * Flag indicating whether to enable GoDaddy configurations
54
+ * Enable GoDaddy-specific linting configurations
55
55
  * @default undefined
56
56
  */
57
57
  godaddy?: boolean | 'typescript';
58
58
  /**
59
- * Flag indicating whether to enable JSDoc configurations
59
+ * Enable or disable JSDoc linting rules
60
60
  * @default true
61
61
  */
62
62
  jsdoc?: boolean;
63
63
  /**
64
- * Flag indicating whether to enable Prettier configurations
64
+ * Enable Prettier for code formatting
65
65
  * @default true
66
66
  */
67
67
  prettier?: boolean;
68
68
  /**
69
- * Flag indicating whether to enable Lodash configurations
69
+ * Enable Lodash-specific linting rules
70
70
  * @default true
71
71
  */
72
72
  lodash?: boolean;
73
73
  /**
74
- * Flag indicating whether to enable CSpell configurations
74
+ * Custom spelling configurations for CSpell
75
75
  * @default {}
76
76
  */
77
77
  cspell?: Options | false;
78
78
  /**
79
- * Flag indicating whether to enable imports configurations
79
+ * Enable imports-related linting configurations
80
80
  * @default true
81
81
  */
82
82
  import?: boolean;
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ type Options = Options$1['cspell'];
11
11
 
12
12
  interface FactoryOptions {
13
13
  /**
14
- * ESLint configuration
14
+ * Custom ESLint configuration to override or extend defaults
15
15
  * @default undefined
16
16
  */
17
17
  config?: Omit<FlatConfigItem, 'name' | 'files'>;
@@ -21,62 +21,62 @@ interface FactoryOptions {
21
21
  */
22
22
  ignores?: string[];
23
23
  /**
24
- * List of development dependencies
24
+ * List of files or directories where development dependencies are allowed
25
25
  * @default undefined
26
26
  */
27
27
  devDependencies?: string[];
28
28
  /**
29
- * List of core modules
29
+ * List of modules to be treated as built-in
30
30
  * @default undefined
31
31
  */
32
32
  coreModules?: string[];
33
33
  /**
34
- * Monorepo scope
34
+ * Specific monorepo scope to apply configurations for
35
35
  * @default undefined
36
36
  */
37
37
  monorepoScope?: string;
38
38
  /**
39
- * Flag indicating whether to enable React configurations
39
+ * Enable React-specific linting rules
40
40
  * @default undefined
41
41
  */
42
42
  react?: boolean | string;
43
43
  /**
44
- * Version of Vue.js (optional)
44
+ * Specify the Vue.js version for linting
45
45
  * @default undefined
46
46
  */
47
47
  vue?: number;
48
48
  /**
49
- * Flag indicating whether ES modules are used
49
+ * Enable ES module linting rules
50
50
  * @default undefined
51
51
  */
52
52
  module?: boolean;
53
53
  /**
54
- * Flag indicating whether to enable GoDaddy configurations
54
+ * Enable GoDaddy-specific linting configurations
55
55
  * @default undefined
56
56
  */
57
57
  godaddy?: boolean | 'typescript';
58
58
  /**
59
- * Flag indicating whether to enable JSDoc configurations
59
+ * Enable or disable JSDoc linting rules
60
60
  * @default true
61
61
  */
62
62
  jsdoc?: boolean;
63
63
  /**
64
- * Flag indicating whether to enable Prettier configurations
64
+ * Enable Prettier for code formatting
65
65
  * @default true
66
66
  */
67
67
  prettier?: boolean;
68
68
  /**
69
- * Flag indicating whether to enable Lodash configurations
69
+ * Enable Lodash-specific linting rules
70
70
  * @default true
71
71
  */
72
72
  lodash?: boolean;
73
73
  /**
74
- * Flag indicating whether to enable CSpell configurations
74
+ * Custom spelling configurations for CSpell
75
75
  * @default {}
76
76
  */
77
77
  cspell?: Options | false;
78
78
  /**
79
- * Flag indicating whether to enable imports configurations
79
+ * Enable imports-related linting configurations
80
80
  * @default true
81
81
  */
82
82
  import?: boolean;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @agilebot/eslint-config v0.7.1
2
+ * @license @agilebot/eslint-config v0.7.3
3
3
  *
4
4
  * Copyright (c) Agilebot, Inc. and its affiliates.
5
5
  *
@@ -618,6 +618,7 @@ function react(opts) {
618
618
  "@eslint-react/dom/no-dangerously-set-innerhtml-with-children": "error",
619
619
  "@eslint-react/dom/no-find-dom-node": "error",
620
620
  "@eslint-react/dom/no-render-return-value": "error",
621
+ "@eslint-react/dom/no-unknown-property": "error",
621
622
  // recommended rules from @eslint-react/hooks-extra
622
623
  "@eslint-react/hooks-extra/prefer-use-state-lazy-initialization": "warn",
623
624
  // recommended rules react-hooks
@@ -671,7 +672,6 @@ function reactJsOnly() {
671
672
  "react/jsx-no-undef": "error",
672
673
  "react/jsx-uses-react": "error",
673
674
  "react/no-unescaped-entities": "error",
674
- "react/no-unknown-property": "error",
675
675
  "react/react-in-jsx-scope": "error",
676
676
  "react/require-render-return": "error"
677
677
  }
@@ -1016,8 +1016,10 @@ function factory(root, options) {
1016
1016
  let rootDir;
1017
1017
  if (typeof root === "string") {
1018
1018
  rootDir = root;
1019
- } else {
1019
+ } else if (root?.url) {
1020
1020
  rootDir = import_node_path3.default.dirname((0, import_node_url.fileURLToPath)(root.url));
1021
+ } else {
1022
+ throw new Error("root must be a string or ImportMeta");
1021
1023
  }
1022
1024
  const tsconfigFiles = (0, import_eslint_utils3.findTsconfigFiles)(rootDir, {
1023
1025
  absolute: true
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @agilebot/eslint-config v0.7.1
2
+ * @license @agilebot/eslint-config v0.7.3
3
3
  *
4
4
  * Copyright (c) Agilebot, Inc. and its affiliates.
5
5
  *
@@ -16,7 +16,7 @@ import {
16
16
  VUE_GLOBS,
17
17
  __dirname,
18
18
  define_STANDARD_RULES_default
19
- } from "./chunk-MQP5VK72.mjs";
19
+ } from "./chunk-CGJVNMKG.mjs";
20
20
 
21
21
  // src/factory/index.ts
22
22
  import assert from "node:assert";
@@ -543,6 +543,7 @@ function react(opts) {
543
543
  "@eslint-react/dom/no-dangerously-set-innerhtml-with-children": "error",
544
544
  "@eslint-react/dom/no-find-dom-node": "error",
545
545
  "@eslint-react/dom/no-render-return-value": "error",
546
+ "@eslint-react/dom/no-unknown-property": "error",
546
547
  // recommended rules from @eslint-react/hooks-extra
547
548
  "@eslint-react/hooks-extra/prefer-use-state-lazy-initialization": "warn",
548
549
  // recommended rules react-hooks
@@ -596,7 +597,6 @@ function reactJsOnly() {
596
597
  "react/jsx-no-undef": "error",
597
598
  "react/jsx-uses-react": "error",
598
599
  "react/no-unescaped-entities": "error",
599
- "react/no-unknown-property": "error",
600
600
  "react/react-in-jsx-scope": "error",
601
601
  "react/require-render-return": "error"
602
602
  }
@@ -939,8 +939,10 @@ function factory(root, options) {
939
939
  let rootDir;
940
940
  if (typeof root === "string") {
941
941
  rootDir = root;
942
- } else {
942
+ } else if (root?.url) {
943
943
  rootDir = path2.dirname(fileURLToPath(root.url));
944
+ } else {
945
+ throw new Error("root must be a string or ImportMeta");
944
946
  }
945
947
  const tsconfigFiles = findTsconfigFiles(rootDir, {
946
948
  absolute: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agilebot/eslint-config",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Agilebot's ESLint config",
5
5
  "bin": {
6
6
  "eslint-agilebot": "bin/eslint-agilebot"
@@ -58,7 +58,7 @@
58
58
  "picocolors": "^1.1.0",
59
59
  "vue-eslint-parser": "^9.4.3",
60
60
  "yargs": "^17.7.2",
61
- "@agilebot/eslint-utils": "0.7.1"
61
+ "@agilebot/eslint-utils": "0.7.3"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/yargs": "^17.0.33",
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "peerDependencies": {
68
68
  "eslint": "^8.57.0 || ^9.0.0",
69
- "@agilebot/eslint-plugin": "0.7.1"
69
+ "@agilebot/eslint-plugin": "0.7.3"
70
70
  },
71
71
  "files": [
72
72
  "bin",