@open-xchange/linter-presets 0.0.6 → 0.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +19 -14
  2. package/README.md +3 -3
  3. package/dist/eslint/config/base.d.ts +16 -0
  4. package/{lib → dist}/eslint/config/base.js +5 -26
  5. package/dist/eslint/config/directives.d.ts +11 -0
  6. package/{lib → dist}/eslint/config/directives.js +1 -5
  7. package/dist/eslint/config/imports.d.ts +15 -0
  8. package/dist/eslint/config/imports.js +58 -0
  9. package/dist/eslint/config/js.d.ts +9 -0
  10. package/dist/eslint/config/js.js +32 -0
  11. package/dist/eslint/config/jsdoc.d.ts +11 -0
  12. package/{lib → dist}/eslint/config/jsdoc.js +1 -9
  13. package/dist/eslint/config/json.d.ts +15 -0
  14. package/{lib → dist}/eslint/config/json.js +2 -8
  15. package/dist/eslint/config/license.d.ts +14 -0
  16. package/{lib → dist}/eslint/config/license.js +12 -18
  17. package/dist/eslint/config/promises.d.ts +11 -0
  18. package/{lib → dist}/eslint/config/promises.js +3 -9
  19. package/dist/eslint/config/stylistic.d.ts +16 -0
  20. package/{lib → dist}/eslint/config/stylistic.js +12 -22
  21. package/dist/eslint/config/ts.d.ts +11 -0
  22. package/{lib → dist}/eslint/config/ts.js +9 -18
  23. package/dist/eslint/config/yaml.d.ts +15 -0
  24. package/{lib → dist}/eslint/config/yaml.js +2 -8
  25. package/dist/eslint/env/browser.d.ts +27 -0
  26. package/{lib → dist}/eslint/env/browser.js +5 -26
  27. package/dist/eslint/env/codecept.d.ts +22 -0
  28. package/{lib → dist}/eslint/env/codecept.js +4 -13
  29. package/dist/eslint/env/eslint.d.ts +20 -0
  30. package/{lib → dist}/eslint/env/eslint.js +2 -9
  31. package/dist/eslint/env/jest.d.ts +21 -0
  32. package/dist/eslint/env/jest.js +49 -0
  33. package/dist/eslint/env/node.d.ts +30 -0
  34. package/{lib → dist}/eslint/env/node.js +2 -14
  35. package/dist/eslint/env/project.d.ts +18 -0
  36. package/{lib → dist}/eslint/env/project.js +18 -25
  37. package/dist/eslint/env/react.d.ts +29 -0
  38. package/{lib → dist}/eslint/env/react.js +3 -15
  39. package/dist/eslint/env/tsconfig.d.ts +21 -0
  40. package/{lib → dist}/eslint/env/tsconfig.js +15 -21
  41. package/dist/eslint/env/vitest.d.ts +23 -0
  42. package/{lib → dist}/eslint/env/vitest.js +3 -16
  43. package/dist/eslint/index.d.ts +63 -0
  44. package/{lib → dist}/eslint/index.js +3 -25
  45. package/dist/eslint/rules/no-amd-module-directive.d.ts +3 -0
  46. package/{lib → dist}/eslint/rules/no-amd-module-directive.js +22 -26
  47. package/dist/eslint/rules/no-invalid-modules.d.ts +38 -0
  48. package/{lib → dist}/eslint/rules/no-invalid-modules.js +40 -63
  49. package/dist/eslint/shared/env-utils.d.ts +150 -0
  50. package/{lib → dist}/eslint/shared/env-utils.js +12 -23
  51. package/dist/eslint/shared/rule-utils.d.ts +76 -0
  52. package/{lib → dist}/eslint/shared/rule-utils.js +27 -60
  53. package/dist/index.d.ts +3 -0
  54. package/{lib → dist}/index.js +0 -1
  55. package/dist/stylelint/index.d.ts +49 -0
  56. package/{lib → dist}/stylelint/index.js +5 -22
  57. package/dist/utils/index.d.ts +12 -0
  58. package/{lib → dist}/utils/index.js +2 -5
  59. package/package.json +12 -4
  60. package/lib/eslint/config/imports.js +0 -68
  61. package/lib/eslint/config/js.js +0 -36
  62. package/lib/eslint/env/browser.d.ts +0 -21
  63. package/lib/eslint/env/codecept.d.ts +0 -14
  64. package/lib/eslint/env/eslint.d.ts +0 -14
  65. package/lib/eslint/env/jest.d.ts +0 -14
  66. package/lib/eslint/env/jest.js +0 -56
  67. package/lib/eslint/env/node.d.ts +0 -28
  68. package/lib/eslint/env/project.d.ts +0 -21
  69. package/lib/eslint/env/react.d.ts +0 -20
  70. package/lib/eslint/env/tsconfig.d.ts +0 -20
  71. package/lib/eslint/env/vitest.d.ts +0 -14
  72. package/lib/eslint/index.d.ts +0 -43
  73. package/lib/eslint/shared/env-utils.d.ts +0 -95
  74. package/lib/eslint/shared/types.d.ts +0 -107
  75. package/lib/index.d.ts +0 -4
  76. package/lib/stylelint/index.d.ts +0 -18
  77. package/lib/stylelint/types.d.ts +0 -44
  78. package/lib/utils/index.d.ts +0 -4
  79. /package/{lib → doc}/eslint/README.md +0 -0
  80. /package/{lib → doc}/eslint/env/browser.md +0 -0
  81. /package/{lib → doc}/eslint/env/codecept.md +0 -0
  82. /package/{lib → doc}/eslint/env/eslint.md +0 -0
  83. /package/{lib → doc}/eslint/env/jest.md +0 -0
  84. /package/{lib → doc}/eslint/env/node.md +0 -0
  85. /package/{lib → doc}/eslint/env/project.md +0 -0
  86. /package/{lib → doc}/eslint/env/react.md +0 -0
  87. /package/{lib → doc}/eslint/env/tsconfig.md +0 -0
  88. /package/{lib → doc}/eslint/env/vitest.md +0 -0
  89. /package/{lib → doc}/stylelint/README.md +0 -0
  90. /package/{lib → doc}/utils/README.md +0 -0
@@ -1,21 +0,0 @@
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;
@@ -1,20 +0,0 @@
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.react".
9
- */
10
- export interface EnvReactOptions extends EnvBaseOptions {
11
-
12
- /**
13
- * Configuration for the rule "react-hooks-static-deps/exhaustive-deps".
14
- */
15
- staticHooks?: Record<string, boolean | readonly boolean[] | Record<string, boolean>>;
16
- }
17
-
18
- // functions ==================================================================
19
-
20
- export default function react(options: EnvReactOptions): FlatConfigArray;
@@ -1,20 +0,0 @@
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.tsconfig".
9
- */
10
- export interface EnvTSConfigOptions extends EnvBaseOptions {
11
-
12
- /**
13
- * The path to the TypeScript project configuration file (`tsconfig.json`).
14
- */
15
- project: string;
16
- }
17
-
18
- // functions ==================================================================
19
-
20
- export default function tsconfig(options: EnvTSConfigOptions): FlatConfigArray;
@@ -1,14 +0,0 @@
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.vitest".
9
- */
10
- export interface EnvVitestOptions extends EnvBaseOptions { }
11
-
12
- // functions ==================================================================
13
-
14
- export default function vitest(options: EnvVitestOptions): FlatConfigArray;
@@ -1,43 +0,0 @@
1
-
2
- import { FlatConfigArray, ConfigureOptions } from "./shared/types";
3
-
4
- import tsconfig from "./env/tsconfig";
5
- import node from "./env/node";
6
- import browser from "./env/browser";
7
- import jest from "./env/jest";
8
- import vitest from "./env/vitest";
9
- import codecept from "./env/codecept";
10
- import react from "./env/react";
11
- import project from "./env/project";
12
- import eslint from "./env/eslint";
13
-
14
- // environments ===============================================================
15
-
16
- /**
17
- * A collection with all available environment presets.
18
- */
19
- export const env: {
20
- tsconfig: typeof tsconfig;
21
- node: typeof node;
22
- browser: typeof browser;
23
- jest: typeof jest;
24
- vitest: typeof vitest;
25
- codecept: typeof codecept;
26
- react: typeof react;
27
- project: typeof project;
28
- eslint: typeof eslint;
29
- };
30
-
31
- // functions ==================================================================
32
-
33
- /**
34
- * Defines standard configuration objects targeting the source files in the
35
- * entire project.
36
- *
37
- * @param options
38
- * Plugin configuration options.
39
- *
40
- * @returns
41
- * An array of configuration objects to be added to the flat configuration.
42
- */
43
- export function configure(options?: ConfigureOptions): FlatConfigArray;
@@ -1,95 +0,0 @@
1
-
2
- import { Linter } from "eslint";
3
-
4
- import { FlatConfigArray } from "./types";
5
-
6
- // types ======================================================================
7
-
8
- /**
9
- * Shared options for an environment preset with included and excluded files.
10
- */
11
- export interface EnvFilesOptions {
12
-
13
- /**
14
- * Glob patterns for source files to be included into the environment.
15
- */
16
- files: readonly string[];
17
-
18
- /**
19
- * Glob patterns for source files matching `files` to be ignored.
20
- */
21
- ignores?: readonly string[];
22
- }
23
-
24
- // ----------------------------------------------------------------------------
25
-
26
- /**
27
- * Shared options for an environment preset: include and exclude files, and add
28
- * more linter rules.
29
- */
30
- export interface EnvBaseOptions extends EnvFilesOptions {
31
-
32
- /**
33
- * Additional linter rules to be added to the configuration.
34
- */
35
- rules?: Linter.RulesRecord;
36
- }
37
-
38
- // ----------------------------------------------------------------------------
39
-
40
- /**
41
- * Configuration for a single banned global or import.
42
- */
43
- export interface EnvRestrictedName {
44
- name: string;
45
- message: string;
46
- }
47
-
48
- /**
49
- * Configuration for a single banned object property.
50
- */
51
- export interface EnvRestrictedProperty {
52
- object: string;
53
- property: string;
54
- message: string;
55
- }
56
-
57
- /**
58
- * Configuration for a single banned syntax construct.
59
- */
60
- export interface EnvRestrictedSyntax {
61
- selector: string;
62
- message: string;
63
- }
64
-
65
- /**
66
- * Collection of banned globals, imports, properties, and syntax constructs.
67
- */
68
- export interface EnvRestrictedItems {
69
- /** The global symbols to be banned. */
70
- globals?: readonly EnvRestrictedName[];
71
- /** The module imports to be banned. */
72
- imports?: readonly EnvRestrictedName[];
73
- /** The global object properties to be banned. */
74
- properties?: readonly EnvRestrictedProperty[];
75
- /** The syntax constructs to be banned. */
76
- syntax?: readonly EnvRestrictedSyntax[];
77
- }
78
-
79
- /**
80
- * Collection of banned globals, imports, properties, and syntax constructs,
81
- * for a specific subset of the files included in an environment.
82
- */
83
- export interface EnvRestrictedOverride extends EnvFilesOptions, EnvRestrictedItems { }
84
-
85
- /**
86
- * Configuration options for restricted imports and globals.
87
- */
88
- export interface EnvRestrictedOptions extends EnvRestrictedItems {
89
- overrides?: readonly EnvRestrictedOverride[];
90
- }
91
-
92
- export interface EnvRestrictedRulesResult {
93
- rules: Linter.RulesRecord;
94
- overrides: FlatConfigArray;
95
- }
@@ -1,107 +0,0 @@
1
-
2
- import { Linter } from "eslint";
3
-
4
- // types ======================================================================
5
-
6
- /**
7
- * An array of ESLint configuration entries in flat-config format.
8
- */
9
- export type FlatConfigArray = Linter.FlatConfig[];
10
-
11
- // ----------------------------------------------------------------------------
12
-
13
- /**
14
- * Configuration options for language and project setup.
15
- */
16
- export interface LanguageOptions {
17
-
18
- /**
19
- * The ECMAScript version to be used in the project (version or year).
20
- * Default value is `2022`.
21
- */
22
- ecmaVersion?: number;
23
-
24
- /**
25
- * Specifies how to treat `.js`, `.jsx`, `.ts`, and `.tsx` files.
26
- *
27
- * - "module": The files will be considered being ES modules.
28
- * - "commonjs": The files will be considered being CommonJS modules.
29
- *
30
- * Default value is "module".
31
- */
32
- sourceType?: "module" | "commonjs";
33
- }
34
-
35
- // ----------------------------------------------------------------------------
36
-
37
- /**
38
- * Configuration options for code style.
39
- */
40
- export interface StylisticOptions {
41
-
42
- /**
43
- * Default indentation size (number of space characters). Will be applied
44
- * to JavaScript, TypeScript, JSON, and YAML files, as well as JSX markup.
45
- * Default value is `2`.
46
- */
47
- indent?: number;
48
-
49
- /**
50
- * Specifies whether to require semicolons following all statements. By
51
- * default, semicolons must be omitted if possible according to ASI rules.
52
- */
53
- semi?: boolean;
54
-
55
- /**
56
- * The type of the string delimiter character. Default value is "single".
57
- */
58
- quotes?: "single" | "double" | "off";
59
-
60
- /**
61
- * Specifies how to treat dangling commas in multiline lists.
62
- *
63
- * - "always": Dangling commas will be required in all multi-line array
64
- * literals, object literals, function parameters, template parameters,
65
- * imports, and exports.
66
- * - "never": Dangling commas will be forbidden.
67
- * - "off": Dangling commas will not be checked.
68
- *
69
- * Default value is "always".
70
- */
71
- dangle?: "always" | "never" | "off";
72
- }
73
-
74
- // ----------------------------------------------------------------------------
75
-
76
- /**
77
- * Configuration options for linting the entire project with ESLint.
78
- */
79
- export interface ConfigureOptions {
80
-
81
- /**
82
- * Glob patterns with all files and folders to be ignored by ESLint.
83
- */
84
- ignores?: readonly string[];
85
-
86
- /**
87
- * Full path to the template file containing the license header to be used
88
- * in all source files. The function `resolver` helps to to convert a local
89
- * path to an absolute path.
90
- */
91
- license?: string;
92
-
93
- /**
94
- * Configuration options for language and project setup.
95
- */
96
- language?: LanguageOptions;
97
-
98
- /**
99
- * Configuration options for code style.
100
- */
101
- stylistic?: StylisticOptions;
102
-
103
- /**
104
- * Additional linter rules to be added to the global configuration.
105
- */
106
- rules?: Linter.RulesRecord;
107
- }
package/lib/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
-
2
- export * as utils from "./utils/index";
3
- export * as eslint from "./eslint/index";
4
- export * as stylelint from "./stylelint/index";
@@ -1,18 +0,0 @@
1
-
2
- import { Config } from "stylelint";
3
-
4
- import { ConfigureOptions } from "./types";
5
-
6
- // functions ==================================================================
7
-
8
- /**
9
- * Defines standard configuration objects targeting the source files in the
10
- * entire project.
11
- *
12
- * @param config
13
- * Plugin configuration.
14
- *
15
- * @returns
16
- * An array of configuration objects to be added to the flat configuration.
17
- */
18
- export function configure(config?: ConfigureOptions): Config;
@@ -1,44 +0,0 @@
1
-
2
- import { Config } from "stylelint";
3
-
4
- // types ======================================================================
5
-
6
- /**
7
- * Configuration options for code style.
8
- */
9
- export interface StylisticOptions {
10
-
11
- /**
12
- * Default indentation size (number of space characters). Default value is
13
- * `2`.
14
- */
15
- indent?: number;
16
-
17
- /**
18
- * The type of the string delimiter character. Default value is "single".
19
- */
20
- quotes?: "single" | "double" | "off";
21
- }
22
-
23
- // ----------------------------------------------------------------------------
24
-
25
- /**
26
- * Configuration options for linting the entire project.
27
- */
28
- export interface ConfigureOptions {
29
-
30
- /**
31
- * Glob patterns with all files and folders to be ignored by StyleLint.
32
- */
33
- ignores?: readonly string[];
34
-
35
- /**
36
- * Configuration options for code style.
37
- */
38
- stylistic?: StylisticOptions;
39
-
40
- /**
41
- * Additional linter rules to be added to the global configuration.
42
- */
43
- rules?: Config["rules"];
44
- }
@@ -1,4 +0,0 @@
1
-
2
- // functions ==================================================================
3
-
4
- export function resolver(url: string): (file: string) => string;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes