@open-xchange/linter-presets 0.0.2 → 0.0.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +14 -3
  2. package/README.md +21 -8
  3. package/lib/eslint/README.md +83 -0
  4. package/lib/eslint/config/base.js +0 -1
  5. package/lib/eslint/config/imports.js +68 -0
  6. package/lib/eslint/config/js.js +1 -1
  7. package/lib/eslint/config/ts.js +1 -1
  8. package/lib/eslint/env/browser.d.ts +10 -2
  9. package/lib/eslint/env/browser.js +44 -30
  10. package/lib/eslint/env/browser.md +33 -0
  11. package/lib/eslint/env/codecept.d.ts +2 -1
  12. package/lib/eslint/env/codecept.md +35 -0
  13. package/lib/eslint/env/eslint.d.ts +14 -0
  14. package/lib/eslint/env/eslint.js +41 -0
  15. package/lib/eslint/env/eslint.md +32 -0
  16. package/lib/eslint/env/jest.d.ts +2 -1
  17. package/lib/eslint/env/jest.md +32 -0
  18. package/lib/eslint/env/node.d.ts +8 -1
  19. package/lib/eslint/env/node.js +10 -6
  20. package/lib/eslint/env/node.md +34 -0
  21. package/lib/eslint/env/project.d.ts +21 -0
  22. package/lib/eslint/env/{plugin.js → project.js} +23 -22
  23. package/lib/eslint/env/project.md +129 -0
  24. package/lib/eslint/env/react.d.ts +2 -1
  25. package/lib/eslint/env/react.md +39 -0
  26. package/lib/eslint/env/tsconfig.d.ts +2 -1
  27. package/lib/eslint/env/tsconfig.js +0 -2
  28. package/lib/eslint/env/tsconfig.md +35 -0
  29. package/lib/eslint/env/vitest.d.ts +2 -1
  30. package/lib/eslint/env/vitest.md +36 -0
  31. package/lib/eslint/index.d.ts +6 -4
  32. package/lib/eslint/index.js +9 -3
  33. package/lib/eslint/rules/no-amd-module-directive.js +57 -0
  34. package/lib/eslint/rules/no-invalid-modules.js +206 -0
  35. package/lib/eslint/shared/env-utils.d.ts +97 -0
  36. package/lib/eslint/shared/env-utils.js +105 -0
  37. package/lib/eslint/shared/rule-utils.js +143 -0
  38. package/lib/eslint/shared/types.d.ts +1 -25
  39. package/lib/index.d.ts +1 -1
  40. package/{doc/stylelint.md → lib/stylelint/README.md} +10 -3
  41. package/lib/stylelint/index.d.ts +2 -2
  42. package/lib/stylelint/index.js +42 -12
  43. package/lib/stylelint/types.d.ts +1 -1
  44. package/package.json +89 -69
  45. package/doc/eslint.md +0 -343
  46. package/lib/eslint/env/plugin.d.ts +0 -13
  47. package/lib/eslint/shared/constants.js +0 -33
  48. /package/{doc/utils.md → lib/utils/README.md} +0 -0
@@ -0,0 +1,34 @@
1
+ # Environment `env.node`
2
+
3
+ Creates configuration objects with global symbols and linter rules for NodeJS modules. Adds the plugin [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) and its recommended rules.
4
+
5
+ ## Signature
6
+
7
+ ```ts
8
+ function node(options: EnvNodeOptions): Linter.FlatConfig[]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ | Name | Type | Default | Description |
14
+ | - | - | - | - |
15
+ | `files` | `string[]` | _required_ | Glob patterns for source files to be included. |
16
+ | `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
17
+ | `sourceType` | `"module"\|"commonjs"` | `"module"` | Specifies how to treat `.js`, `.jsx`, `.ts`, and `.tsx`. |
18
+ | `restricted` | `EnvRestrictedOptions` | `{}` | Settings for banned globals, imports, object properties, and syntax constructs. |
19
+ | `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the configuration. |
20
+
21
+ ## Example
22
+
23
+ ```js
24
+ // eslint.config.js
25
+ import { utils, eslint } from "@open-xchange/linter-presets"
26
+
27
+ export default [
28
+ ...eslint.configure({ /* ... */ }),
29
+ ...eslint.env.node({
30
+ files: ["*.config.{js,ts}", "scripts/**/*.js"],
31
+ rules: { /* ... */ },
32
+ }),
33
+ ]
34
+ ```
@@ -0,0 +1,21 @@
1
+
2
+ import { FlatConfigArray } from "../shared/types";
3
+ import { EnvBaseOptions } from "../shared/env-utils";
4
+
5
+ // types ======================================================================
6
+
7
+ /**
8
+ * Configuration options for the environment preset "env.project".
9
+ */
10
+ export interface EnvProjectOptions extends EnvBaseOptions {
11
+
12
+ /**
13
+ * Maps all alias prefixes to actual paths in the project. All paths must
14
+ * be relative to the project's root directory.
15
+ */
16
+ alias?: Record<string, string>;
17
+ }
18
+
19
+ // functions ==================================================================
20
+
21
+ export default function project(options: EnvProjectOptions): FlatConfigArray;
@@ -19,43 +19,44 @@
19
19
  *
20
20
  */
21
21
 
22
- import eslintPlugin from "eslint-plugin-eslint-plugin";
22
+ import noAmdModuleDirective from "../rules/no-amd-module-directive.js";
23
+ import noInvalidModules from "../rules/no-invalid-modules.js";
23
24
 
24
25
  // exports ====================================================================
25
26
 
26
27
  /**
27
- * Adds linter rules for ESLint plugin implementations.
28
+ * Adds custom linter rules for checking project setup and module hierarchy.
28
29
  *
29
- * Wraps the following packages:
30
- * - `eslint-plugin-eslint-plugin`
31
- *
32
- * @param {import("./plugin").EnvPluginOptions} options
30
+ * @param {import("./project").EnvProjectOptions} options
33
31
  * Configuration options for the environment.
34
32
  *
35
33
  * @returns {import("../shared/types").FlatConfigArray}
36
34
  * An array of configuration objects to be added to the flat configuration.
37
35
  */
38
- export default function plugin(options) {
36
+ export default function project(options) {
39
37
 
40
38
  // configuration properties
41
- const { files, ignores = [], rules = {} } = options;
42
- // the plugin configuration
43
- const pluginConfig = eslintPlugin.configs["flat/rules-recommended"];
39
+ const { files, ignores = [], rules, ...rest } = options;
44
40
 
45
- return [
41
+ return [{
42
+ files,
43
+ ignores,
46
44
 
47
- // register rule implementations and recommended rules
48
- {
49
- files,
50
- ignores,
51
- ...pluginConfig,
45
+ // register rule implementations
46
+ plugins: {
47
+ "env-project": {
48
+ rules: {
49
+ "no-amd-module-directive": noAmdModuleDirective,
50
+ "no-invalid-modules": noInvalidModules,
51
+ },
52
+ },
52
53
  },
53
54
 
54
- // reconfigure plugin rules
55
- {
56
- files,
57
- ignores,
58
- rules,
55
+ // configure rules
56
+ rules: {
57
+ "env-project/no-amd-module-directive": "error",
58
+ "env-project/no-invalid-modules": ["error", rest],
59
+ ...rules,
59
60
  },
60
- ];
61
+ }];
61
62
  }
@@ -0,0 +1,129 @@
1
+ # Environment `env.project`
2
+
3
+ Creates configuration objects for custom project setup and module imports.
4
+
5
+ - Source files will be checked for the correct usage of ES modules with static `import` and `export` statements, as well as dynamic `import` expressions. For the latter, only literal strings will be checked, other expressions that build the imported module names dynamically cannot be checked.
6
+
7
+ - Enforces an hierarchy of internal packages. If a project distributes its source files into multiple installation packages, the dependencies between these packages can be checked to prevent that files from a base package import files from a dependent package (which may not get installed on the target machine).
8
+
9
+ - Bans the TypeScript compiler directive `<amd-module>`. This directive was used in the past to declare module names when transpiling TypeScript module code to AMD modules.
10
+
11
+ ## Signature
12
+
13
+ ```ts
14
+ function project(options: EnvProjectOptions): Linter.FlatConfig[]
15
+ ```
16
+
17
+ ## Options
18
+
19
+ | Name | Type | Default | Description |
20
+ | - | - | - | - |
21
+ | `files` | `string[]` | _required_ | Glob patterns for source files to be included. |
22
+ | `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
23
+ | `alias` | `Record<string, string>` | `{}` | Maps all alias prefixes to actual paths in the project (see below). |
24
+ | `external` | `string \| string[]` | `[]` | Specifies glob patterns for external modules (see below). |
25
+ | `packages` | `Record<string, EnvProjectPackage>` | `{}` | Allows to separate the source files into virtual packages (see below). |
26
+ | `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the configuration. |
27
+
28
+ ### Option `alias`
29
+
30
+ - Type: `Record<string, string>`
31
+ - Default: `{}`
32
+
33
+ Maps all alias prefixes to actual paths in the project. All paths must be relative to the project's root directory.
34
+
35
+ #### `alias` Example
36
+
37
+ ```js
38
+ // eslint.config.js
39
+ import { eslint } from "@open-xchange/linter-presets"
40
+
41
+ export default [
42
+ ...eslint.configure({ /* ... */ }),
43
+ ...eslint.env.project({
44
+ files: ["src/**/*.{js,ts}"],
45
+ alias: {
46
+ "@": "src",
47
+ },
48
+ }),
49
+ ]
50
+ ```
51
+
52
+ - The alias prefix `"@/"` of a module name will be replaced with the path `src/` to check the existence of source files.
53
+ - The module `"@/my/module"` will correspond to the file `src/my/module.js` (relative to the project's root directory).
54
+
55
+ ### Option `external`
56
+
57
+ - Type: `string | string[]`
58
+ - Default: `[]`
59
+
60
+ Specifies glob patterns for modules that can be imported although there is no module file available, e.g. due to build tool configuration.
61
+
62
+ #### `external` Example
63
+
64
+ ```js
65
+ // eslint.config.js
66
+ import { eslint } from "@open-xchange/linter-presets"
67
+
68
+ export default [
69
+ ...eslint.configure({ /* ... */ }),
70
+ ...eslint.env.project({
71
+ files: ["src/**/*.{js,ts}"],
72
+ alias: { "@": "src" },
73
+ external: ["virtual:*", "@/special/lib/**/*.js"],
74
+ }),
75
+ ]
76
+ ```
77
+
78
+ - All imports starting with `"virtual:"` will not be checked.
79
+ - All imports of `.js` files deeply inside `src/special/lib/` will not be checked.
80
+
81
+ ### Option `packages`
82
+
83
+ - Type: `Record<string, EnvProjectPackage>`
84
+ - Default: `{}`
85
+
86
+ Allows to separate the source files into several virtual packages. This option is completely independent from any actual packaging performed in later steps of the build process. Its solely purpose is to impose dependencies between the source files to prevent importing files between specific packages.
87
+
88
+ Each key in the `packages` record is the arbitrary unique name of a package. The record values must be objects satisfying the interface `EnvProjectPackage`:
89
+
90
+ | Name | Type | Default | Description |
91
+ | - | - | - | - |
92
+ | `src` | `string\|string[]` | _required_ | Glob patterns selecting all source files that are part of the package. |
93
+ | `dependsOn` | `string\|string[]` | `[]` | Specifies the names of all packages (dictionary keys of the option `packages`) this package depends on. |
94
+ | `optional` | `boolean` | `false` | Set to `true` to mark an optional package that may be missing in an installation. Such a package cannot be imported statically (with `import` statement) from a non-optional package, but can only be loaded dynamically at runtime (by calling `import()`). The rule will mark all static imports of optional code as an error. |
95
+
96
+ Modules that are part of such a package may import any modules from the same package, or from packages it depends on (also recursively from their dependent packages).
97
+
98
+ Example configuration:
99
+
100
+ ```js
101
+ // eslint.config.js
102
+ import { eslint } from "@open-xchange/linter-presets"
103
+
104
+ export default [
105
+ ...eslint.configure({ /* ... */ }),
106
+ ...eslint.env.project({
107
+ files: ["src/**/*.{js,ts}"],
108
+ alias: { "@": "src" },
109
+ packages: {
110
+ base: {
111
+ src: ["@/base/**/*", "@/tools/**/*"],
112
+ },
113
+ debug: {
114
+ src: "@/debug/**/*",
115
+ dependsOn: "base",
116
+ optional: true,
117
+ },
118
+ special: {
119
+ src: "@/my/special/**/*",
120
+ dependsOn: ["base", "debug"],
121
+ },
122
+ },
123
+ }),
124
+ ]
125
+ ```
126
+
127
+ - The package `base` contains all modules starting with `@/base/` or `@/tools/`. All modules in the package `base` can import themselves, but they cannot import any other modules from the project.
128
+ - The _optional_ package `debug` contains all modules starting with `@/debug/`. Modules in this package can import other modules from this package, and from the package `base`. Modules in this package can only be imported dynamically from other packages.
129
+ - The package `special` contains all modules starting with `@/my/special/`. Modules in this package can import other modules from this package, and all modules from the packages `base` and `debug`. The latter package can only be imported dynamically.
@@ -1,5 +1,6 @@
1
1
 
2
- import { FlatConfigArray, EnvBaseOptions } from "../shared/types.js";
2
+ import { FlatConfigArray } from "../shared/types";
3
+ import { EnvBaseOptions } from "../shared/env-utils";
3
4
 
4
5
  // types ======================================================================
5
6
 
@@ -0,0 +1,39 @@
1
+ # Environment `env.react`
2
+
3
+ Creates configuration objects with linter rules for ReactJS. Adds the following plugins and their recommended rules:
4
+
5
+ - [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react)
6
+ - [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks)
7
+ - [eslint-plugin-react-hooks-static-deps](https://github.com/stoikio/eslint-plugin-react-hooks-static-deps)
8
+ - [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh)
9
+ - [eslint-plugin-jsx-expressions](https://github.com/hluisson/eslint-plugin-jsx-expressions)
10
+ - [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
11
+
12
+ ## Signature
13
+
14
+ ```ts
15
+ function react(options: EnvReactOptions): Linter.FlatConfig[]
16
+ ```
17
+
18
+ ## Options
19
+
20
+ | Name | Type | Default | Description |
21
+ | - | - | - | - |
22
+ | `files` | `string[]` | _required_ | Glob patterns for source files to be included. |
23
+ | `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
24
+ | `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the configuration. |
25
+
26
+ ## Example
27
+
28
+ ```js
29
+ // eslint.config.js
30
+ import { eslint } from "@open-xchange/linter-presets"
31
+
32
+ export default [
33
+ ...eslint.configure({ /* ... */ }),
34
+ ...eslint.env.react({
35
+ files: ["src/**/*.{js,ts}"],
36
+ rules: { /* ... */ },
37
+ }),
38
+ ]
39
+ ```
@@ -1,5 +1,6 @@
1
1
 
2
- import { FlatConfigArray, EnvBaseOptions } from "../shared/types.js";
2
+ import { FlatConfigArray } from "../shared/types";
3
+ import { EnvBaseOptions } from "../shared/env-utils";
3
4
 
4
5
  // types ======================================================================
5
6
 
@@ -28,8 +28,6 @@ export default function tsconfig(options) {
28
28
 
29
29
  // configure plugin rules
30
30
  rules: {
31
- // imports will be checked by TSC
32
- "n/no-missing-import": "off",
33
31
  // custom rules
34
32
  ...rules,
35
33
  },
@@ -0,0 +1,35 @@
1
+ # Environment `env.tsconfig`
2
+
3
+ Creates configuration objects for TypeScript projects (registers a `tsconfig.json` file in the project).
4
+
5
+ ## Signature
6
+
7
+ ```ts
8
+ function tsconfig(options: EnvTSConfigOptions): Linter.FlatConfig[]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ | Name | Type | Default | Description |
14
+ | - | - | - | - |
15
+ | `files` | `string[]` | _required_ | Glob patterns for source files to be included. |
16
+ | `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
17
+ | `project` | `string` | _required_ | The absolute path to the TypeScript project configuration file (`tsconfig.json`). |
18
+ | `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the configuration. |
19
+
20
+ ## Example
21
+
22
+ ```js
23
+ // eslint.config.js
24
+ import { utils, eslint } from "@open-xchange/linter-presets"
25
+
26
+ const resolve = utils.resolver(import.meta.url)
27
+
28
+ export default [
29
+ ...eslint.configure({ /* ... */ }),
30
+ ...eslint.env.tsconfig({
31
+ files: ["src/**/*.ts"],
32
+ project: resolve("src/tsconfig.json"),
33
+ }),
34
+ ]
35
+ ```
@@ -1,5 +1,6 @@
1
1
 
2
- import { FlatConfigArray, EnvBaseOptions } from "../shared/types.js";
2
+ import { FlatConfigArray } from "../shared/types";
3
+ import { EnvBaseOptions } from "../shared/env-utils";
3
4
 
4
5
  // types ======================================================================
5
6
 
@@ -0,0 +1,36 @@
1
+ # Environment `env.vitest`
2
+
3
+ Creates configuration objects with global symbols and linter rules for unit tests using Vitest. Adds the following plugins and their recommended rules:
4
+
5
+ - [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest)
6
+ - [eslint-plugin-testing-library](https://github.com/testing-library/eslint-plugin-testing-library)
7
+ - [eslint-plugin-jest-dom](https://github.com/testing-library/eslint-plugin-jest-dom)
8
+
9
+ ## Signature
10
+
11
+ ```ts
12
+ function vitest(options: EnvVitestOptions): Linter.FlatConfig[]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ | Name | Type | Default | Description |
18
+ | - | - | - | - |
19
+ | `files` | `string[]` | _required_ | Glob patterns for source files to be included. |
20
+ | `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
21
+ | `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the configuration. |
22
+
23
+ ## Example
24
+
25
+ ```js
26
+ // eslint.config.js
27
+ import { eslint } from "@open-xchange/linter-presets"
28
+
29
+ export default [
30
+ ...eslint.configure({ /* ... */ }),
31
+ ...eslint.env.vitest({
32
+ files: ["test/**/*.{js,ts}"],
33
+ rules: { /* ... */ },
34
+ }),
35
+ ]
36
+ ```
@@ -1,5 +1,5 @@
1
1
 
2
- import { FlatConfigArray, ESLintConfigureOptions } from "./shared/types";
2
+ import { FlatConfigArray, ConfigureOptions } from "./shared/types";
3
3
 
4
4
  import tsconfig from "./env/tsconfig";
5
5
  import node from "./env/node";
@@ -8,7 +8,8 @@ import jest from "./env/jest";
8
8
  import vitest from "./env/vitest";
9
9
  import codecept from "./env/codecept";
10
10
  import react from "./env/react";
11
- import plugin from "./env/plugin";
11
+ import project from "./env/project";
12
+ import eslint from "./env/eslint";
12
13
 
13
14
  // environments ===============================================================
14
15
 
@@ -23,7 +24,8 @@ export const env: {
23
24
  vitest: typeof vitest;
24
25
  codecept: typeof codecept;
25
26
  react: typeof react;
26
- plugin: typeof plugin;
27
+ project: typeof project;
28
+ eslint: typeof eslint;
27
29
  };
28
30
 
29
31
  // functions ==================================================================
@@ -38,4 +40,4 @@ export const env: {
38
40
  * @returns
39
41
  * An array of configuration objects to be added to the flat configuration.
40
42
  */
41
- export function configure(options?: ESLintConfigureOptions): FlatConfigArray;
43
+ export function configure(options?: ConfigureOptions): FlatConfigArray;
@@ -6,6 +6,7 @@ import json from "./config/json.js";
6
6
  import yaml from "./config/yaml.js";
7
7
  import license from "./config/license.js";
8
8
  import directives from "./config/directives.js";
9
+ import imports from "./config/imports.js";
9
10
  import promises from "./config/promises.js";
10
11
  import jsdoc from "./config/jsdoc.js";
11
12
  import stylistic from "./config/stylistic.js";
@@ -17,7 +18,8 @@ import jest from "./env/jest.js";
17
18
  import vitest from "./env/vitest.js";
18
19
  import codecept from "./env/codecept.js";
19
20
  import react from "./env/react.js";
20
- import plugin from "./env/plugin.js";
21
+ import project from "./env/project.js";
22
+ import eslint from "./env/eslint.js";
21
23
 
22
24
  // environment presets ========================================================
23
25
 
@@ -32,7 +34,8 @@ export const env = {
32
34
  vitest,
33
35
  codecept,
34
36
  react,
35
- plugin,
37
+ project,
38
+ eslint,
36
39
  };
37
40
 
38
41
  // functions ==================================================================
@@ -41,7 +44,7 @@ export const env = {
41
44
  * Generates standard configuration objects targeting the source files in the
42
45
  * entire project.
43
46
  *
44
- * @param {import("./shared/types").ESLintConfigureOptions} [options]
47
+ * @param {import("./shared/types").ConfigureOptions} [options]
45
48
  * Plugin configuration options.
46
49
  *
47
50
  * @returns {import("./shared/types").FlatConfigArray}
@@ -91,6 +94,9 @@ export function configure(options) {
91
94
  // default configuration for ESLint inline directives
92
95
  ...directives(),
93
96
 
97
+ // default configuration for imports/exports
98
+ ...imports(languageOptions),
99
+
94
100
  // default configuration for native promises
95
101
  ...promises(),
96
102
 
@@ -0,0 +1,57 @@
1
+ /*
2
+ * @copyright Copyright (c) Open-Xchange GmbH, Germany <info@open-xchange.com>
3
+ * @license AGPL-3.0
4
+ *
5
+ * This code is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with OX App Suite. If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>.
17
+ *
18
+ * Any use of the work other than as authorized under this license or copyright law is prohibited.
19
+ *
20
+ */
21
+
22
+ // exports ====================================================================
23
+
24
+ /** @type {import("eslint").Rule.RuleModule} */
25
+ export default {
26
+
27
+ meta: {
28
+ type: "problem",
29
+ schema: [],
30
+ messages: {
31
+ UNEXPECTED_DIRECTIVE: "Unexpected '<amd-module>' directive.",
32
+ UNEXPECTED_DIRECTIVE_FIX: "Delete the '<amd-module>' directive.",
33
+ },
34
+ hasSuggestions: true,
35
+ fixable: "code",
36
+ },
37
+
38
+ create(context) {
39
+
40
+ return {
41
+
42
+ // fail if module contains triple-slash directive "<amd-module>"
43
+ Program(node) {
44
+ const amdComment = node.comments.find(comment => /^\/\s*<amd-module/.test(comment.value));
45
+ if (amdComment) {
46
+ const deleteDirective = fixer => fixer.remove(amdComment);
47
+ context.report({
48
+ messageId: "UNEXPECTED_DIRECTIVE",
49
+ node: amdComment,
50
+ fix: deleteDirective,
51
+ suggest: [{ messageId: "UNEXPECTED_DIRECTIVE_FIX", fix: deleteDirective }],
52
+ });
53
+ }
54
+ },
55
+ };
56
+ },
57
+ };