@nextcloud/eslint-config 8.4.1 → 9.0.0-rc.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/AUTHORS.md ADDED
@@ -0,0 +1,26 @@
1
+ <!--
2
+ - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3
+ - SPDX-License-Identifier: AGPL-3.0-or-later
4
+ -->
5
+ # Authors
6
+
7
+ - Andy Scherzinger <info@andy-scherzinger.de>
8
+ - Christoph Wurst <christoph@winzerhof-wurst.at>
9
+ - Christopher Ng <chrng8@gmail.com>
10
+ - Daniel Calviño Sánchez <danxuliu@gmail.com>
11
+ - Daniel Kesselberg <mail@danielkesselberg.de>
12
+ - dartcafe <github@dartcafe.de>
13
+ - Ferdinand Thiessen <opensource@fthiessen.de>
14
+ - Grigorii K. Shartsev <me@shgk.me>
15
+ - Joas Schilling <213943+nickvergessen@users.noreply.github.com>
16
+ - John Molakvoæ <skjnldsv@protonmail.com>
17
+ - Julius Härtl <jus@bitgrid.net>
18
+ - korelstar <korelstar@users.noreply.github.com>
19
+ - Louis Chemineau <louis@chmn.me>
20
+ - Marco Ambrosini <marcoambrosini@pm.me>
21
+ - Pytal <24800714+Pytal@users.noreply.github.com>
22
+ - Raimund Schlüßler <raimund.schluessler@mailbox.org>
23
+ - René Gieling <github@dartcafe.de>
24
+ - Richard Steinmetz <richard@steinmetz.cloud>
25
+ - Vincent Petry <vincent@nextcloud.com>
26
+ - Vinicius Reis <vinicius.reis@nextcloud.com>
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
+ <!--
2
+ - SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
3
+ - SPDX-License-Identifier: AGPL-3.0-or-later
4
+ -->
1
5
  # Changelog
2
6
 
7
+ ## [v9.0.0](https://github.com/nextcloud-libraries/eslint-config/tree/v9.0.0) (2025)
8
+
9
+ ### Breaking
10
+ This package now is using ESLint v9 and requires ESLint flat configurations.
11
+ Please refer to the README on how to adjust your configuration for flat config.
12
+
13
+ ### Added
14
+ * feat: New modular config for (and with) ESLint v9 support [#887](https://github.com/nextcloud-libraries/eslint-config/pull/887)
15
+ * Merge plugin repository [#899](https://github.com/nextcloud-libraries/eslint-config/pull/899)
16
+
17
+ ### Fixed
18
+ * fix(codestyle): Enforce no space before function parenthesis [#901](https://github.com/nextcloud-libraries/eslint-config/pull/901)
19
+ * fix(codeStyle): Adjust `stylistic` rules config [#914](https://github.com/nextcloud-libraries/eslint-config/pull/914)
20
+
21
+ ### Changed
22
+ * Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802)
23
+ * Updated development dependencies
24
+ * refactor(json): drop now unneeded `@ts-expect-error` [#915](https://github.com/nextcloud-libraries/eslint-config/pull/915)
25
+ * Updated `@eslint/json` to 0.11.0
26
+ * Updated `@stylistic/eslint-plugin` 4.2.0
27
+ * Updated `eslint-plugin-jsdoc` to 50.6.9
28
+ * Updated `eslint-plugin-vue` to 10.0.0
29
+ * Updated `fast-xml-parser` to 5.0.9
30
+ * Updated `sort-package-json` to 3.0.0
31
+ * Updated `typescript-eslint` to 8.28.0
32
+
33
+ ## [v8.4.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.2) (2025-02-16)
34
+ ### Fixed
35
+ * fix(typescript): do not require returns type in jsdoc by @ShGKme in https://github.com/nextcloud-libraries/eslint-config/pull/857
36
+
37
+ ### Changed
38
+ * Updated development dependencies
39
+ * Add SPDX header by @AndyScherzinger in https://github.com/nextcloud-libraries/eslint-config/pull/802
40
+ * enh(git): ignore formatting commits in git blame by @max-nextcloud in https://github.com/nextcloud-libraries/eslint-config/pull/854
41
+
3
42
  ## [v8.4.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.1) (2024-05-16)
4
43
 
5
44
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.4.0...v8.4.1)
package/README.md CHANGED
@@ -1,15 +1,19 @@
1
+ <!--
2
+ - SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
3
+ - SPDX-License-Identifier: AGPL-3.0-or-later
4
+ -->
1
5
  ## @nextcloud/eslint-config
2
6
 
7
+ [![REUSE status](https://api.reuse.software/badge/github.com/nextcloud-libraries/eslint-config)](https://api.reuse.software/info/github.com/nextcloud-libraries/eslint-config)
3
8
  [![npm last version](https://img.shields.io/npm/v/@nextcloud/eslint-config.svg?style=flat-square)](https://www.npmjs.com/package/@nextcloud/eslint-config)
4
9
  [![Lint status](https://img.shields.io/github/actions/workflow/status/nextcloud-libraries/eslint-config/lint-eslint.yml?label=lint&style=flat-square)](https://github.com/nextcloud-libraries/eslint-config/actions/workflows/lint.yml)
5
10
  [![Dependabot status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg?longCache=true&style=flat-square&logo=dependabot)](https://dependabot.com)
6
11
 
7
12
 
8
- This is a package containing the unified global eslint config used by all nextcloud apps.
13
+ This is a package containing the unified global eslint config used by all nextcloud apps and libraries.
9
14
  It contains the necessary dependencies and peerDependencies so that other apps cannot update if this config does not support it.
10
15
  Please always use dependabot to update your apps, OR pay attention to the peer dependencies error messages!
11
16
 
12
-
13
17
  ## Installation
14
18
 
15
19
  ```bash
@@ -18,45 +22,120 @@ npm install @nextcloud/eslint-config --save-dev
18
22
 
19
23
  ## Usage
20
24
 
21
- Add a file `.eslintrc.js` in the root directory of your app repository with the following content:
25
+ > [!NOTE]
26
+ > Since version 9 this package depends on ESLint 9, which uses the new flat config system.
27
+
28
+ This package provides some predefined configurations you can choose from.
29
+ For the recommended setup add a file `eslint.config.js` in the root directory of your app repository with the following content:
22
30
 
23
31
  ```js
24
- module.exports = {
25
- extends: [
26
- '@nextcloud',
27
- ],
28
- }
32
+ import { recommended } from '@nextcloud/eslint-config'
33
+
34
+ export default [
35
+ ...recommended,
36
+ ]
29
37
  ```
30
38
 
31
- ### Usage with Typescript projects
39
+ ### Available configurations
32
40
 
33
- If your projects uses Typescript for vue files, like `<script lang="ts">` then use the Typescript config instead:
41
+ Instead of the `recommended` configuration this package also provides some alternatives, depending on your app setup you can also choose:
34
42
 
35
- Add a file `.eslintrc.js` in the root directory of your app repository with the following content:
43
+ * `recommended`
44
+ * General rules including code style
45
+ * Support for Typescript
46
+ * Support for Vue **3**
47
+ * Support Vue files with Typescript syntax (the script within `.vue` files will be handled as Typescript).
48
+ * `recommendedJavascript`
49
+ * Same as `recommended` but Vue files (the script part) will be handled as Javascript.
50
+ * `recommendedVue2`
51
+ * Same as `recommended` but Vue files are considered in Vue 2 syntax.
52
+ * `recommendedVue2Javascript`
53
+ * Same as `recommended` but Vue files are considered in Vue 2 syntax and the script part will be handled as Javascript instead of Typescript.
36
54
 
37
- ```js
38
- module.exports = {
39
- extends: [
40
- '@nextcloud/eslint-config/typescript',
41
- ],
42
- }
43
- ```
55
+ ### Bundled plugins
44
56
 
45
- ### Usage with Vue 3 projects
57
+ This configuration also provides some bundled plugins with new rules, those options are already included in the recommended configurations.
46
58
 
47
- If your projects uses Vue 3 you have to use the `vue3` sub-configuration.
48
- This configuration also includes Typescript support by default.
49
-
50
- Add a file `.eslintrc.js` in the root directory of your app repository with the following content:
59
+ It is possible to override the recommended configurations:
60
+ ```js
61
+ // eslint.config.js
62
+ import { recommended } from '@nextcloud/eslint-config'
63
+ export default [
64
+ ...recommended,
65
+ {
66
+ files: ['**/*.js'],
67
+ rules: {
68
+ // Make deprecations error instead of warning level
69
+ '@nextcloud/no-deprecations': ['error'],
70
+ }
71
+ }
72
+ ]
73
+ ```
51
74
 
75
+ You can even use the plugins without using the Nextcloud ESLint config:
52
76
  ```js
53
- module.exports = {
54
- extends: [
55
- '@nextcloud/eslint-config/vue3',
56
- ],
57
- }
77
+ // eslint.config.js
78
+ import { nextcloudPlugin } from '@nextcloud/eslint-config'
79
+ export default [
80
+ {
81
+ files: ['**/*.js'],
82
+ plugins: {
83
+ '@nextcloud': nextcloudPlugin,
84
+ },
85
+ rules: {
86
+ '@nextcloud/no-removed-apis': ['error', { targetVersion: '29.0.0' }],
87
+ },
88
+ }
89
+ ]
58
90
  ```
59
91
 
92
+ #### `package-json` plugin
93
+ Rules:
94
+ - `sort-package-json`
95
+ - Ensures the `package.json` is sorted in consistent order
96
+ - Included as `error` level in recommended configurations
97
+
98
+ #### `@nextcloud` plugin
99
+ Rules:
100
+ - `no-deprecations`
101
+ - Report usage of deprecated Nextcloud API
102
+ - Included as `warn` level in recommended configuration
103
+ - Available options
104
+ ```ts
105
+ {
106
+ /**
107
+ * Limit deprecated API to specified Nextcloud version
108
+ * @example '29.0.0'
109
+ * @default ''
110
+ */
111
+ targetVersion?: string
112
+ /**
113
+ * Try to find appinfo.xml to detect targetVersion
114
+ * @default true
115
+ */
116
+ parseAppInfo?: boolean
117
+ }
118
+ ```
119
+ - `no-removed-apis`
120
+ - Report usage of removed Nextcloud API
121
+ - Included as `error` level in recommended configuration
122
+ - Available options
123
+ ```ts
124
+ {
125
+ /**
126
+ * Limit removed API to specified Nextcloud version
127
+ * @example '29.0.0'
128
+ * @default ''
129
+ */
130
+ targetVersion?: string
131
+ /**
132
+ * Try to find appinfo.xml to detect targetVersion
133
+ * @default true
134
+ */
135
+ parseAppInfo?: boolean
136
+ }
137
+ ```
138
+
60
139
  ## Release new version
61
140
 
62
141
  1. Update CHANGELOG.md file with the latest changes
@@ -0,0 +1,31 @@
1
+ import { ESLint } from 'eslint';
2
+ import { Linter } from 'eslint';
3
+
4
+ export declare const nextcloudPlugin: ESLint.Plugin;
5
+
6
+ /**
7
+ * ESLint plugin to sort package.json files in a consistent way.
8
+ */
9
+ export declare const packageJsonPlugin: ESLint.Plugin;
10
+
11
+ /**
12
+ * Nextcloud shared configuration for projects using Vue 3 with Typescript <script> blocks
13
+ */
14
+ export declare const recommended: (Linter.Config<Linter.RulesRecord> | Linter.BaseConfig<Linter.RulesRecord, Linter.RulesRecord>)[];
15
+
16
+ /**
17
+ * Nextcloud shared configuration for projects using Vue 3 with Javascript <script> blocks
18
+ */
19
+ export declare const recommendedJavascript: (Linter.Config<Linter.RulesRecord> | Linter.BaseConfig<Linter.RulesRecord, Linter.RulesRecord>)[];
20
+
21
+ /**
22
+ * Nextcloud shared configuration for projects using Vue 2 with Typescript <script> blocks
23
+ */
24
+ export declare const recommendedVue2: (Linter.Config<Linter.RulesRecord> | Linter.BaseConfig<Linter.RulesRecord, Linter.RulesRecord>)[];
25
+
26
+ /**
27
+ * Nextcloud shared configuration for projects using Vue 2 with Javascript <script> blocks
28
+ */
29
+ export declare const recommendedVue2Javascript: (Linter.Config<Linter.RulesRecord> | Linter.BaseConfig<Linter.RulesRecord, Linter.RulesRecord>)[];
30
+
31
+ export { }