@open-xchange/linter-presets 0.3.0 → 0.3.1
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 +5 -0
- package/dist/eslint/index.js +12 -4
- package/doc/eslint/README.md +14 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.1] - 2024-08-01
|
|
4
|
+
|
|
5
|
+
- added: [ESLint] default ignore globs (`dist`, `gitlab-ci`, and others)
|
|
6
|
+
- changed: [ESLint] default values of `stylistic` option (indent 4 spaces, always semicolons, double quotes)
|
|
7
|
+
|
|
3
8
|
## [0.3.0] - 2024-08-01
|
|
4
9
|
|
|
5
10
|
- chore: [ESLint] [major bump of `typescript-eslint` to v8](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/)
|
package/dist/eslint/index.js
CHANGED
|
@@ -43,6 +43,14 @@ export const env = {
|
|
|
43
43
|
* An array of configuration objects to be added to the flat configuration.
|
|
44
44
|
*/
|
|
45
45
|
export function configure(options) {
|
|
46
|
+
const ignores = [
|
|
47
|
+
"*/.yarn/*",
|
|
48
|
+
"dist/*",
|
|
49
|
+
"vite.config.ts.*.mjs",
|
|
50
|
+
"gitlab-ci/*",
|
|
51
|
+
".gitlab-ci.yml",
|
|
52
|
+
...(options?.ignores ?? []),
|
|
53
|
+
];
|
|
46
54
|
// resolve language configuration options
|
|
47
55
|
const languageOptions = {
|
|
48
56
|
ecmaVersion: 2022,
|
|
@@ -52,15 +60,15 @@ export function configure(options) {
|
|
|
52
60
|
};
|
|
53
61
|
// resolve stylistic configuration options
|
|
54
62
|
const stylisticOptions = {
|
|
55
|
-
indent:
|
|
56
|
-
semi: "
|
|
57
|
-
quotes: "
|
|
63
|
+
indent: 4,
|
|
64
|
+
semi: "always",
|
|
65
|
+
quotes: "double",
|
|
58
66
|
dangle: "always",
|
|
59
67
|
...options?.stylistic,
|
|
60
68
|
};
|
|
61
69
|
return [
|
|
62
70
|
// ignore certain files and folders
|
|
63
|
-
|
|
71
|
+
{ ignores },
|
|
64
72
|
// module types and standard rules for all JS/TS source files
|
|
65
73
|
...base(languageOptions),
|
|
66
74
|
// default configuration for JavaScript files
|
package/doc/eslint/README.md
CHANGED
|
@@ -32,19 +32,29 @@ function configure(options?: ConfigureOptions): Linter.FlatConfig[]
|
|
|
32
32
|
|
|
33
33
|
| Name | Type | Default | Description |
|
|
34
34
|
| - | - | - | - |
|
|
35
|
-
| `ignores` | `string[]` | `[]` | Glob patterns with all files and folders to be ignored by ESLint. |
|
|
35
|
+
| `ignores` | `string[]` | `[]` | Glob patterns with all files and folders to be ignored by ESLint. This package already defines a few standard ignore globs (see below). |
|
|
36
36
|
| `license` | `string` | `""` | Full path to the template file containing the license header to be used in all source files. |
|
|
37
37
|
| `language` | `LanguageOptions` | | Configuration options for language and project setup. |
|
|
38
38
|
| `language.ecmaVersion` | `number` | `2022` | The ECMAScript version to be used in the project (version or year). |
|
|
39
39
|
| `language.sourceType` | `"module"\|"commonjs"` | `"module"` | Specifies how to treat `.js`, `.jsx`, `.ts`, and `.tsx` files. |
|
|
40
40
|
| `language.nativeDecorators` | `boolean` | `false` | Whether to support native ES decorators in JavaScript code (via Babel plugin). Does not affect TypeScript code which uses an own parser aware of the decorator syntax. |
|
|
41
41
|
| `stylistic` | `StylisticOptions` | | Configuration options for code style. |
|
|
42
|
-
| `stylistic.indent` | `number` | `
|
|
43
|
-
| `stylistic.semi` | `
|
|
44
|
-
| `stylistic.quotes` | `"single"\|"double"\|"off"` | `"
|
|
42
|
+
| `stylistic.indent` | `number` | `4` | Default indentation size (number of space characters). Will be applied to JavaScript, TypeScript, JSON, and YAML files, as well as JSX markup. |
|
|
43
|
+
| `stylistic.semi` | `"always"\|"never"\|"off"` | `"always"` | Specifies whether to require semicolons following all statements (`"always"`), or to force to omit semicolons if possible according to ASI rules (`"never"`). |
|
|
44
|
+
| `stylistic.quotes` | `"single"\|"double"\|"off"` | `"double"` | The type of the string delimiter character. |
|
|
45
45
|
| `stylistic.dangle` | `"always"\|"never"\|"off"` | `"always"` | Specifies how to treat dangling commas in multiline lists. |
|
|
46
46
|
| `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the global configuration. |
|
|
47
47
|
|
|
48
|
+
#### Built-in Ignore Globs
|
|
49
|
+
|
|
50
|
+
This package defines ignore globs for the following files and directories:
|
|
51
|
+
|
|
52
|
+
- `*/.yarn/*` (internal setup files of Yarn v2+)
|
|
53
|
+
- `dist/*` (standard build output directory)
|
|
54
|
+
- `vite.config.ts.*.mjs` (intermediate files of Vite dev server)
|
|
55
|
+
- `gitlab-ci/*` (GitLab CI configuration files)
|
|
56
|
+
- `.gitlab-ci.yml` (GitLab CI configuration files)
|
|
57
|
+
|
|
48
58
|
#### `configure` Example
|
|
49
59
|
|
|
50
60
|
```js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/linter-presets",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Configuration presets for ESLint and StyleLint",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://gitlab.open-xchange.com/fspd/npm-packages/linter-presets"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"eslint-plugin-vitest": "0.5.4",
|
|
56
56
|
"eslint-plugin-yml": "1.14.0",
|
|
57
57
|
"find-up": "7.0.0",
|
|
58
|
-
"globals": "15.
|
|
58
|
+
"globals": "15.9.0",
|
|
59
59
|
"picomatch": "4.0.2",
|
|
60
60
|
"stylelint-config-standard": "36.0.1",
|
|
61
61
|
"stylelint-config-standard-less": "3.0.1",
|