Skip to content

Commit

Permalink
WebUI: Update @typescript-eslint/{eslint-plugin,parser} to v6.7.4.
Browse files Browse the repository at this point in the history
This is a necessary preparatory step for updating TypeScript to v5.2 in
a follow-up CL.

The new version has moved the location of the main binary, from
node_modules/@typescript-eslint/parser to
node_modules/@typescript-eslint/parser/dist/index.js.

Updated to the new path in several .eslintrc.js files.

Moreover, with the newer version several new errors in
ash/webui/camera_app_ui/ had to be fixed/suppressed.
 - Updated eslint-plugin-jsdoc from v37.5.1 to v46.8.2 to fix
   internal errors when running ESLint.
 - Replaced @typescript-eslint/sort-type-union-intersection-members
   with @typescript-eslint/sort-type-constituents (rule was renamed).
 - Removed jsdoc/newline-after-description rule (no longer exists)
 - Moved @typescript-eslint/prefer-optional-chain as needed in the
   .eslintrc.js file, since it now requires `parserOptions.project`
   to be specified for it to work.
 - Updated jsdoc/tag-lines rule definition, as needed to fix new
   errors (default spec for that rule seem to has changed)
 - Fixed newly found @typescript-eslint/prefer-nullish-coalescing
   violation.

(Some ash/webui/camera_app_ui/ fixes provided by pihsun@)

Bug: 1488690,b/303328674
Change-Id: I6667118a490b9177486d3cf90934ee43292eb1b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4910239
Reviewed-by: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1205440}
  • Loading branch information
freshp86 authored and Chromium LUCI CQ committed Oct 4, 2023
1 parent 7ab8f46 commit 1c17e50
Show file tree
Hide file tree
Showing 11 changed files with 281 additions and 357 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports = {

'overrides': [{
'files': ['**/*.ts'],
'parser': './third_party/node/node_modules/@typescript-eslint/parser',
'parser': './third_party/node/node_modules/@typescript-eslint/parser/dist/index.js',
'plugins': [
'@typescript-eslint',
],
Expand Down
11 changes: 5 additions & 6 deletions ash/webui/camera_app_ui/resources/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ module.exports = {
},
},
},
parser: `${typescriptEslintDir}/parser`,
parser: `${typescriptEslintDir}/parser/dist/index.js`,
plugins: ['@typescript-eslint', 'jsdoc', 'eslint-plugin-cca'],
// Generally, the rules should be compatible to both bundled and the newest
// stable eslint, so it's easier to upgrade and develop without the full
Expand Down Expand Up @@ -696,9 +696,7 @@ module.exports = {
},
],

'@typescript-eslint/prefer-optional-chain': 'error',

'@typescript-eslint/sort-type-union-intersection-members': 'error',
'@typescript-eslint/sort-type-constituents': 'error',

'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
Expand Down Expand Up @@ -748,7 +746,6 @@ module.exports = {
'jsdoc/check-values': 'error',
'jsdoc/empty-tags': 'error',
'jsdoc/implements-on-classes': 'error',
'jsdoc/newline-after-description': 'error',
'jsdoc/no-undefined-types': 'error',
'jsdoc/require-param-description': 'error',
'jsdoc/require-param-name': 'error',
Expand All @@ -759,7 +756,7 @@ module.exports = {
'jsdoc/require-returns-check': 'error',
'jsdoc/require-returns-description': 'error',
'jsdoc/require-yields-check': 'error',
'jsdoc/tag-lines': 'error',
'jsdoc/tag-lines': ['error', 'never', {startLines: 1}],
'jsdoc/valid-types': 'error',

'no-invalid-this': 'off',
Expand All @@ -782,6 +779,8 @@ module.exports = {

'@typescript-eslint/prefer-nullish-coalescing': 'error',

'@typescript-eslint/prefer-optional-chain': 'error',

// go/tsstyle#optimization-compatibility-for-property-access
'@typescript-eslint/dot-notation': 'error',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export async function getMaybeLazyDirectory(
name: string): Promise<DirectoryAccessEntry> {
const targetDir =
await parentDir.getDirectory({name, createIfNotExist: false});
return targetDir !== null ? targetDir :
new LazyDirectoryEntry(parentDir, name);
return targetDir ?? new LazyDirectoryEntry(parentDir, name);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions ash/webui/diagnostics_ui/resources/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
'overrides': [{
'files': ['**/*.ts'],
'parser':
'../../../../third_party/node/node_modules/@typescript-eslint/parser',
'../../../../third_party/node/node_modules/@typescript-eslint/parser/dist/index.js',
'parserOptions': {
tsconfigRootDir: __dirname,
},
Expand All @@ -30,4 +30,4 @@ module.exports = {
},
}],
};
// clang-format on
// clang-format on
4 changes: 2 additions & 2 deletions ash/webui/print_management/resources/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
'overrides': [{
'files': ['**/*.ts'],
'parser':
'../../../../third_party/node/node_modules/@typescript-eslint/parser',
'../../../../third_party/node/node_modules/@typescript-eslint/parser/dist/index.js',
'parserOptions': {
tsconfigRootDir: __dirname,
},
Expand All @@ -29,4 +29,4 @@ module.exports = {
},
}],
};
// clang-format on
// clang-format on
4 changes: 2 additions & 2 deletions ash/webui/shortcut_customization_ui/resources/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
'overrides': [{
'files': ['**/*.ts'],
'parser':
'../../../../third_party/node/node_modules/@typescript-eslint/parser',
'../../../../third_party/node/node_modules/@typescript-eslint/parser/dist/index.js',
'parserOptions': {
tsconfigRootDir: __dirname,
},
Expand All @@ -29,4 +29,4 @@ module.exports = {
},
}],
};
// clang-format on
// clang-format on
2 changes: 1 addition & 1 deletion chrome/test/data/pdf/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {

'overrides': [{
'files': ['**/*.ts'],
'parser': '../../../../third_party/node/node_modules/@typescript-eslint/parser',
'parser': '../../../../third_party/node/node_modules/@typescript-eslint/parser/dist/index.js',
'plugins': [
'@typescript-eslint',
],
Expand Down
2 changes: 1 addition & 1 deletion third_party/node/node_modules.tar.gz.sha1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ddc7cddc319ae5689ebf2c927e284814f2892e47
8fe0f8ea6861e4629e91aca59ea581f96a33fb91
Loading

0 comments on commit 1c17e50

Please sign in to comment.