-
Notifications
You must be signed in to change notification settings - Fork 31
chore: update @oclif/core to v4 and migrate ESLint to v9 flat config #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,3 +16,4 @@ junit.xml | |
| oclif.manifest.json | ||
| .vscode | ||
| .idea | ||
| .claude | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| Copyright 2019 Adobe Inc. All rights reserved. | ||
| This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. You may obtain a copy | ||
| of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software distributed under | ||
| the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
| OF ANY KIND, either express or implied. See the License for the specific language | ||
| governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| const aioConfig = require('@adobe/eslint-config-aio-lib-config') | ||
| const jestPlugin = require('eslint-plugin-jest') | ||
|
|
||
| const testGlobals = { | ||
| fixtureFile: 'readonly', | ||
| fixtureFileWithTimeZoneAdjustment: 'readonly', | ||
| fixtureJson: 'readonly', | ||
| fixtureZip: 'readonly', | ||
| fakeFileSystem: 'readonly', | ||
| createTestBaseFlagsFunction: 'readonly', | ||
| createTestFlagsFunction: 'readonly' | ||
| } | ||
|
|
||
| module.exports = [ | ||
| ...aioConfig, | ||
| { | ||
| ignores: ['node_modules/**', 'coverage/**'] | ||
| }, | ||
| { | ||
| files: ['test/**/*.js', 'e2e/**/*.js'], | ||
| ...jestPlugin.configs['flat/recommended'], | ||
| languageOptions: { | ||
| globals: { | ||
| ...jestPlugin.configs['flat/recommended'].languageOptions.globals, | ||
| ...testGlobals | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,79 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| /* | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2019 Adobe Inc. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| you may not use this file except in compliance with the License. You may obtain a copy | ||||||||||||||||||||||||||||||||||||||||||||||||||
| of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Unless required by applicable law or agreed to in writing, software distributed under | ||||||||||||||||||||||||||||||||||||||||||||||||||
| the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| OF ANY KIND, either express or implied. See the License for the specific language | ||||||||||||||||||||||||||||||||||||||||||||||||||
| governing permissions and limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * Print a simple text table to stdout. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * Replaces ux.table from @oclif/core v1-v3 (removed in v4). | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param {Array} data - Array of data objects | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param {object} columns - Column definitions. Each key maps to a column. Supports: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * - header {string}: column header (defaults to key, capitalized) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * - get {function}: accessor function (defaults to row[key]) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * - minWidth {number}: minimum column width | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param {object} [options] - Options: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * - printLine {function}: function to print a line (defaults to process.stdout.write) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * - 'no-header' {boolean}: skip printing the header row | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * - 'no-truncate' {boolean}: ignored (included for API compatibility) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| function table (data, columns, options = {}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const printLine = options.printLine || ((s) => process.stdout.write(s + '\n')) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const cols = Object.keys(columns).map(key => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const col = columns[key] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const header = typeof col.header === 'string' ? col.header : key.charAt(0).toUpperCase() + key.slice(1) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const getValue = col.get || ((row) => row[key]) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const minWidth = Math.max(col.minWidth || 0, col.maxWidth || 0, header.length + 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return { key, header, getValue, minWidth } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Compute string values for all rows | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const rows = data.map(row => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const result = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const col of cols) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const val = col.getValue(row) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| result[col.key] = val != null ? String(val) : '' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return result | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Compute column widths: max of minWidth and widest value + 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const widths = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const col of cols) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const maxDataWidth = rows.length > 0 ? Math.max(...rows.map(r => r[col.key].length)) : 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| widths[col.key] = Math.max(col.minWidth, maxDataWidth + 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+54
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const rowStart = ' ' | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Print header and divider | ||||||||||||||||||||||||||||||||||||||||||||||||||
| let header = rowStart | ||||||||||||||||||||||||||||||||||||||||||||||||||
| let divider = rowStart | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const col of cols) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const w = widths[col.key] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| header += col.header.padEnd(w) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| divider += ''.padEnd(w - 1, '─') + ' ' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| printLine(header) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| printLine(divider) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+58
to
+67
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Print header and divider | |
| let header = rowStart | |
| let divider = rowStart | |
| for (const col of cols) { | |
| const w = widths[col.key] | |
| header += col.header.padEnd(w) | |
| divider += ''.padEnd(w - 1, '─') + ' ' | |
| } | |
| printLine(header) | |
| printLine(divider) | |
| const noHeader = options['no-header'] | |
| // Print header and divider (unless suppressed) | |
| if (!noHeader) { | |
| let header = rowStart | |
| let divider = rowStart | |
| for (const col of cols) { | |
| const w = widths[col.key] | |
| header += col.header.padEnd(w) | |
| divider += ''.padEnd(w - 1, '─') + ' ' | |
| } | |
| printLine(header) | |
| printLine(divider) | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The legacy
.eslintrcincluded an explicitjsdoc/tag-linesoverride, but that rule override is not present in the new flat config. If that behavior is still desired, add an equivalentrulesentry ineslint.config.js(or document that the rule was intentionally dropped as part of the migration).