@nextcloud/eslint-config 8.4.2 → 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/CHANGELOG.md CHANGED
@@ -4,6 +4,32 @@
4
4
  -->
5
5
  # Changelog
6
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
+
7
33
  ## [v8.4.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.2) (2025-02-16)
8
34
  ### Fixed
9
35
  * fix(typescript): do not require returns type in jsdoc by @ShGKme in https://github.com/nextcloud-libraries/eslint-config/pull/857
@@ -14,6 +40,7 @@
14
40
  * enh(git): ignore formatting commits in git blame by @max-nextcloud in https://github.com/nextcloud-libraries/eslint-config/pull/854
15
41
 
16
42
  ## [v8.4.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.1) (2024-05-16)
43
+
17
44
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.4.0...v8.4.1)
18
45
 
19
46
  ### Fixes
package/README.md CHANGED
@@ -10,11 +10,10 @@
10
10
  [![Dependabot status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg?longCache=true&style=flat-square&logo=dependabot)](https://dependabot.com)
11
11
 
12
12
 
13
- 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.
14
14
  It contains the necessary dependencies and peerDependencies so that other apps cannot update if this config does not support it.
15
15
  Please always use dependabot to update your apps, OR pay attention to the peer dependencies error messages!
16
16
 
17
-
18
17
  ## Installation
19
18
 
20
19
  ```bash
@@ -23,45 +22,120 @@ npm install @nextcloud/eslint-config --save-dev
23
22
 
24
23
  ## Usage
25
24
 
26
- 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:
27
30
 
28
31
  ```js
29
- module.exports = {
30
- extends: [
31
- '@nextcloud',
32
- ],
33
- }
32
+ import { recommended } from '@nextcloud/eslint-config'
33
+
34
+ export default [
35
+ ...recommended,
36
+ ]
34
37
  ```
35
38
 
36
- ### Usage with Typescript projects
39
+ ### Available configurations
37
40
 
38
- 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:
39
42
 
40
- 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.
41
54
 
42
- ```js
43
- module.exports = {
44
- extends: [
45
- '@nextcloud/eslint-config/typescript',
46
- ],
47
- }
48
- ```
55
+ ### Bundled plugins
49
56
 
50
- ### 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.
51
58
 
52
- If your projects uses Vue 3 you have to use the `vue3` sub-configuration.
53
- This configuration also includes Typescript support by default.
54
-
55
- 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
+ ```
56
74
 
75
+ You can even use the plugins without using the Nextcloud ESLint config:
57
76
  ```js
58
- module.exports = {
59
- extends: [
60
- '@nextcloud/eslint-config/vue3',
61
- ],
62
- }
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
+ ]
63
90
  ```
64
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
+
65
139
  ## Release new version
66
140
 
67
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 { }