Skip to content

Commit 6c9f395

Browse files
feat: udpate eslint 8.0 to 9.0
1 parent 89007cd commit 6c9f395

33 files changed

+4501
-3617
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,33 @@ Issues labelled `good first contribution`.
7272
7373
# Release Process
7474

75-
### Branching Strategy:
75+
## Branching Strategy
7676

7777
- **Main Branch**: Ongoing development and new features are submitted to the `main` branch.
7878

79-
- **Release Branches**: We'll utilize dedicated branches for managing releases.
79+
- **Release Branch**: The `release` branch will represent the latest released/releasable code.
8080

81-
- **Major Release:**
82-
- Create a new branch named `release-<major version>` (e.g., `release-2` for a `2.0` release) from `main` to manage the release process.
83-
- Update the `.releaserc.json` file: Locate the `branches` property and specify the newly created release branch name (e.g., `release-2`).
84-
- **Minor/Patch Release:**
85-
- We will use existing major release branches (e.g. `release-2`) for subsequent minor and patch releases (e.g. `2.0.1`, `2.1.2`, etc.).
86-
- Once changes are verified and merged into the release branch, they will be merged back to `main`.
81+
## Preparing for a New Release
8782

88-
- **Trigger Release Manually:**
89-
- Navigate to the `Actions` tab in GitHub repository.
90-
- Select the `release` workflow from the left sidebar.
91-
- Click the `Run workflow` button to initiate the release process.
83+
- Code from `main` will be contributed to the `release` branch through a PR. Once reviewed,
84+
it will be merged and ready to cut a new release.
85+
- This process should be followed for major (`x+1.0.0`) and minor (`x.y+1.0`)
86+
releases with new feature sets.
87+
88+
## Preparing a Patch to an Existing Release
89+
90+
- For patches to an existing release (`x.y.z+1`), PRs will be submitted directly against
91+
the `release` branch. Once reviewed, PRs will be merged and ready to cut a new release.
92+
- This process will only apply to bug fixes on the `release` branch.
93+
94+
## Cutting a Release
95+
96+
- This project leverages [`semantic-release`](https://github.com/semantic-release/semantic-release#readme)
97+
to automatically determine SemVer versioning and publish the package to npmjs.com.
98+
- To trigger a release:
99+
- Navigate to the `Actions` tab in the GitHub repository
100+
- Select the `release` workflow from the left sidebar
101+
- Click the `Run workflow` button to initiate the release process
92102

93103
# Code of Conduct
94104

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,27 @@ $ npm install --save-dev @salesforce/eslint-plugin-lwc-mobile
1818

1919
## Configuration
2020

21-
Here's an example snippet of a `.eslintrc.json` configuration file, that will configure the `eslint-plugin-lwc-mobile` plugin. Extending the `plugin:@salesforce/lwc-mobile/recommended` ESLint configuration will enable static analysis on all `.js` files used in your Lightning web components.
21+
### ESLint &gt;= 9
22+
23+
The default configurations are now in the flat config format supported by ESLint 9 and beyond. To include `recommendedConfigs ` in your flat config, spread it into your configuration array. Note that `recommendedConfigs` is a collection of preset configs and must be expanded accordingly.:
24+
25+
```javascript
26+
// eslint.config.mjs
27+
import js from '@eslint/js';
28+
import lwcMobilePlugin from "@salesforce/eslint-plugin-lwc-mobile";
29+
30+
export default [
31+
{ plugins: { "@salesforce/lwc-mobile": lwcMobilePlugin } },
32+
js.configs.recommended,
33+
...lwcMobilePlugin.recommendedConfigs,
34+
];
35+
```
36+
37+
### ESLint &lt; 9
38+
Configurations for legacy ESLint have moved to `-legacy` extensions. Here's an example snippet of a `.eslintrc.json` configuration file, that will configure the `eslint-plugin-lwc-mobile` plugin. Extending the `plugin:@salesforce/lwc-mobile/recommended-legacy` ESLint configuration will enable static analysis on all `.js` files used in your Lightning web components.
2239

2340
```json
2441
{
25-
"extends": ["eslint:recommended", "plugin:@salesforce/lwc-mobile/recommended"]
42+
"extends": ["eslint:recommended", "plugin:@salesforce/lwc-mobile/recommended-legacy"]
2643
}
2744
```

package-lock.json

Lines changed: 3899 additions & 3509 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@salesforce/eslint-plugin-lwc-mobile",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"description": "ESLint plugin for LWC mobility",
55
"contributors": [
66
{
@@ -31,7 +31,7 @@
3131
"url": "https://github.com/salesforce/eslint-plugin-lwc-mobile"
3232
},
3333
"scripts": {
34-
"clean": "npx rimraf dist reports",
34+
"clean": "npx rimraf dist reports tsconfig.tsbuildinfo",
3535
"build": "npm run clean && tsc",
3636
"format": "prettier --list-different \"**/*.{ts,js}\"",
3737
"format:fix": "prettier --write \"**/*.{ts,js,json}\"",
@@ -59,41 +59,39 @@
5959
"/dist"
6060
],
6161
"dependencies": {
62-
"@graphql-eslint/eslint-plugin": "^3.20.1"
62+
"@babel/core": "^7.27.4",
63+
"@babel/eslint-parser": "^7.27.5",
64+
"@graphql-eslint/eslint-plugin": "^3.20.1",
65+
"@types/eslint": "^9.6.1",
66+
"typescript-eslint": "^8.17.0"
6367
},
6468
"devDependencies": {
65-
"@commitlint/cli": "^19.5.0",
66-
"@commitlint/config-conventional": "^19.5.0",
67-
"@eslint/js": "^9.14.0",
69+
"@commitlint/cli": "^19.7.1",
70+
"@commitlint/config-conventional": "^19.7.1",
71+
"@eslint/js": "^9.21.0",
6872
"@jest/globals": "^29.7.0",
6973
"@semantic-release/changelog": "^6.0.3",
7074
"@semantic-release/exec": "^6.0.3",
7175
"@semantic-release/git": "^10.0.1",
7276
"@semantic-release/npm": "^12.0.1",
73-
"@types/eslint": "^8.56.10",
7477
"@types/estree": "^1.0.6",
7578
"@types/jest": "^29.5.14",
76-
"@typescript-eslint/eslint-plugin": "^7.8.0",
77-
"@typescript-eslint/parser": "^7.18.0",
78-
"@typescript-eslint/rule-tester": "^7.8.0",
79-
"@typescript-eslint/utils": "^7.8.0",
8079
"conventional-changelog-conventionalcommits": "^8.0.0",
81-
"eslint": "^8.57.0",
82-
"eslint-plugin-eslint-plugin": "^6.3.1",
80+
"eslint": "^9.28.0",
81+
"eslint-plugin-eslint-plugin": "^6.4.0",
8382
"eslint-plugin-node": "^11.1.0",
84-
"husky": "^9.1.6",
83+
"husky": "^9.1.7",
8584
"jest": "^29.7.0",
8685
"jest-chain": "^1.1.6",
8786
"jest-extended": "^4.0.1",
8887
"jest-junit": "^16.0.0",
8988
"jest-mock-extended": "^3.0.7",
9089
"jest-sonar-reporter": "^2.0.0",
91-
"prettier": "^3.3.3",
92-
"semantic-release": "^24.2.0",
93-
"ts-jest": "^29.2.5",
90+
"prettier": "^3.5.2",
91+
"semantic-release": "^24.2.3",
92+
"ts-jest": "^29.2.6",
9493
"ts-node": "^10.9.2",
95-
"typescript": "^5.6.3",
96-
"typescript-eslint": "^7.8.0"
94+
"typescript": "^5.8.2"
9795
},
9896
"peerDependencies": {
9997
"eslint": ">=7"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* SPDX-License-Identifier: MIT
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
7-
import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint';
7+
import { Linter } from 'eslint';
88

99
export = {
1010
plugins: ['@salesforce/lwc-mobile', '@graphql-eslint']
11-
} satisfies ClassicConfig.Config;
11+
} satisfies Linter.BaseConfig;

src/configs/recommended-legacy.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2024, salesforce.com, inc.
3+
* All rights reserved.
4+
* SPDX-License-Identifier: MIT
5+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6+
*/
7+
import { Linter } from 'eslint';
8+
import { APEX_IMPORT_RULE_ID } from '../rules/apex/apex-import.js';
9+
import { NO_MUTATION_SUPPORTED_RULE_ID } from '../rules/graphql/no-mutation-supported';
10+
import { NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID } from '../rules/graphql/no-aggregate-query-supported';
11+
import { UNSUPPORTED_SCOPE_RULE_ID } from '../rules/graphql/unsupported-scope.js';
12+
import { NO_FISCAL_DATE_FILTER_SUPPORTED_RULE_ID } from '../rules/graphql/no-fiscal-date-filtering-supported.js';
13+
import { NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID } from '../rules/graphql/no-semi-anti-join-supported';
14+
import { NO_MORE_THAN_1_PARENT_RECORD_RULE_ID } from '../rules/graphql/no-more-than-1-parent-record.js';
15+
import { NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID } from '../rules/graphql/no-more-than-3-child-entities.js';
16+
import { NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID } from '../rules/graphql/no-more-than-3-root-entities.js';
17+
import { NO_MORE_THAN_100_FIELDS_RULE_ID } from '../rules/graphql/no-more-than-100-fields.js';
18+
import { createScopedModuleRuleName } from '../util/rule-helpers.js';
19+
20+
export = {
21+
extends: ['./configs/base-legacy'],
22+
parser: '@babel/eslint-parser',
23+
parserOptions: {
24+
requireConfigFile: false,
25+
babelOptions: {
26+
parserOpts: {
27+
plugins: [['decorators', { decoratorsBeforeExport: false }]]
28+
}
29+
},
30+
ecmaVersion: 'latest',
31+
sourceType: 'module'
32+
},
33+
rules: {
34+
[createScopedModuleRuleName(APEX_IMPORT_RULE_ID)]: 'warn'
35+
},
36+
overrides: [
37+
{
38+
files: ['*.js'],
39+
processor: '@graphql-eslint/graphql'
40+
},
41+
{
42+
files: ['*.graphql'],
43+
parser: '@graphql-eslint/eslint-plugin',
44+
45+
parserOptions: {
46+
skipGraphQLConfig: true
47+
},
48+
rules: {
49+
[createScopedModuleRuleName(NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID)]: 'warn',
50+
[createScopedModuleRuleName(NO_FISCAL_DATE_FILTER_SUPPORTED_RULE_ID)]: 'warn',
51+
[createScopedModuleRuleName(NO_MUTATION_SUPPORTED_RULE_ID)]: 'warn',
52+
[createScopedModuleRuleName(NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID)]: 'warn',
53+
[createScopedModuleRuleName(NO_MORE_THAN_1_PARENT_RECORD_RULE_ID)]: 'warn',
54+
[createScopedModuleRuleName(NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID)]: 'warn',
55+
[createScopedModuleRuleName(NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID)]: 'warn',
56+
[createScopedModuleRuleName(NO_MORE_THAN_100_FIELDS_RULE_ID)]: 'warn',
57+
[createScopedModuleRuleName(UNSUPPORTED_SCOPE_RULE_ID)]: 'warn'
58+
}
59+
}
60+
]
61+
} satisfies Linter.BaseConfig;

src/configs/recommended.ts

Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
* SPDX-License-Identifier: MIT
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
7-
import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint';
7+
8+
import { Linter } from 'eslint';
9+
810
import { APEX_IMPORT_RULE_ID } from '../rules/apex/apex-import.js';
911
import { NO_MUTATION_SUPPORTED_RULE_ID } from '../rules/graphql/no-mutation-supported';
1012
import { NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID } from '../rules/graphql/no-aggregate-query-supported';
@@ -16,35 +18,51 @@ import { NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID } from '../rules/graphql/no-more-
1618
import { NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID } from '../rules/graphql/no-more-than-3-root-entities.js';
1719
import { NO_MORE_THAN_100_FIELDS_RULE_ID } from '../rules/graphql/no-more-than-100-fields.js';
1820
import { createScopedModuleRuleName } from '../util/rule-helpers.js';
21+
import { parseForESLint as parseForESLintGraphQL } from '@graphql-eslint/eslint-plugin';
22+
import { parseForESLint as parseForESLintBabel, parse } from '@babel/eslint-parser';
23+
import { processors } from '@graphql-eslint/eslint-plugin';
1924

20-
export = {
21-
extends: ['./configs/base'],
22-
rules: {
23-
[createScopedModuleRuleName(APEX_IMPORT_RULE_ID)]: 'warn'
24-
},
25-
overrides: [
26-
{
27-
files: ['*.js'],
28-
processor: '@graphql-eslint/graphql'
25+
const configs: Linter.Config[] = [
26+
{
27+
files: ['*.js', '**/*.js'],
28+
languageOptions: {
29+
parser: { parseForESLint: parseForESLintBabel, parse },
30+
parserOptions: {
31+
requireConfigFile: false,
32+
babelOptions: {
33+
parserOpts: {
34+
plugins: [['decorators', { decoratorsBeforeExport: false }]]
35+
}
36+
},
37+
ecmaVersion: 'latest',
38+
sourceType: 'module'
39+
}
2940
},
30-
{
31-
files: ['*.graphql'],
32-
parser: '@graphql-eslint/eslint-plugin',
33-
41+
processor: processors.graphql,
42+
rules: {
43+
[createScopedModuleRuleName(APEX_IMPORT_RULE_ID)]: 'warn'
44+
}
45+
},
46+
{
47+
files: ['*.graphql', '**/*.graphql'],
48+
languageOptions: {
49+
parser: { parseForESLint: parseForESLintGraphQL },
3450
parserOptions: {
3551
skipGraphQLConfig: true
36-
},
37-
rules: {
38-
[createScopedModuleRuleName(NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID)]: 'warn',
39-
[createScopedModuleRuleName(NO_FISCAL_DATE_FILTER_SUPPORTED_RULE_ID)]: 'warn',
40-
[createScopedModuleRuleName(NO_MUTATION_SUPPORTED_RULE_ID)]: 'warn',
41-
[createScopedModuleRuleName(NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID)]: 'warn',
42-
[createScopedModuleRuleName(NO_MORE_THAN_1_PARENT_RECORD_RULE_ID)]: 'warn',
43-
[createScopedModuleRuleName(NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID)]: 'warn',
44-
[createScopedModuleRuleName(NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID)]: 'warn',
45-
[createScopedModuleRuleName(NO_MORE_THAN_100_FIELDS_RULE_ID)]: 'warn',
46-
[createScopedModuleRuleName(UNSUPPORTED_SCOPE_RULE_ID)]: 'warn'
4752
}
53+
},
54+
rules: {
55+
[createScopedModuleRuleName(NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID)]: 'warn',
56+
[createScopedModuleRuleName(NO_FISCAL_DATE_FILTER_SUPPORTED_RULE_ID)]: 'warn',
57+
[createScopedModuleRuleName(NO_MUTATION_SUPPORTED_RULE_ID)]: 'warn',
58+
[createScopedModuleRuleName(NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID)]: 'warn',
59+
[createScopedModuleRuleName(NO_MORE_THAN_1_PARENT_RECORD_RULE_ID)]: 'warn',
60+
[createScopedModuleRuleName(NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID)]: 'warn',
61+
[createScopedModuleRuleName(NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID)]: 'warn',
62+
[createScopedModuleRuleName(NO_MORE_THAN_100_FIELDS_RULE_ID)]: 'warn',
63+
[createScopedModuleRuleName(UNSUPPORTED_SCOPE_RULE_ID)]: 'warn'
4864
}
49-
]
50-
} satisfies ClassicConfig.Config;
65+
}
66+
];
67+
68+
export = configs;

src/docs/apex-import.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# apex-import
22

3-
Using Apex in LWC Offline-enabled mobile apps requires additional considerations to ensure proper functioning in offline scenarios.
3+
Using Apex in LWC Offline-enabled mobile apps requires additional considerations to ensure proper functioning in offline scenarios. Consider using GraphQL for mobile offline use cases.
44

5-
When a client device is offline, Apex-based features can read data that was cached while online, but changes (writing data) can’t be saved back to the server. Nor can a change via Apex methods be enqueued as a draft into the Offline Queue. A Lightning web component that uses Apex must be prepared to handle a network connection error as a normal response, for both reading and writing operations.
6-
7-
See [Use Apex While Mobile and Offline](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/apex.htm) for more details.
5+
GraphQL is a flexible, powerful query language for accessing record and other data. You can think of GraphQL as SQL for your API, the query language for relational databases.
86

7+
Developers like GraphQL for modern web applications because, in contrast to many REST and CRUD-oriented APIs, GraphQL allows for expressive queries, with features like filtering and scopes, ordering and aggregation, pagination, and relationship traversal to related records. A single query can retrieve many records, and even records of multiple types. Using fewer queries reduces the number of server requests required to load data, which can improve performance. A GraphQL query can specify precisely and only the fields required for a given component, reducing the amount of data that needs to be transmitted before a page can render.
98

9+
For mobile developers building apps that work while offline, however, there is only one implementation that matters: Offline GraphQL.
1010

11+
See [Use GraphQL While Mobile and Offline](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/apex.htm) and [GraphQL Wire Adapter for LWC](https://developer.salesforce.com/docs/platform/graphql/guide/graphql-wire-lwc.html) for more details.

0 commit comments

Comments
 (0)