Skip to content

Commit dd4094c

Browse files
authored
Merge pull request #525 from gitKrystan/fix-523
Fix CLI results output
2 parents bfe310a + 2edb82d commit dd4094c

File tree

112 files changed

+1106
-871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1106
-871
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = {
3737
'unicorn/consistent-destructuring': 'off',
3838
'unicorn/consistent-function-scoping': ['error', { checkArrowFunctions: false }],
3939
'unicorn/custom-error-definition': 'error',
40-
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
40+
'unicorn/filename-case': 'off',
4141
'unicorn/no-array-callback-reference': 'off',
4242
'unicorn/no-array-method-this-argument': 'off', // False positives
4343
'unicorn/no-null': 'off',

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
node-version: ${{ matrix.node-version }}
2222
cache: yarn
2323
- run: yarn install --frozen-lockfile
24-
- run: yarn lint:js
24+
- run: yarn lint
2525
- run: yarn test

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ The codemod accepts the following options, passed as CLI arguments, set in a `.c
3434
| `--classic-decorator` / `classicDecorator` | `boolean` | `true` | Enable/disable adding the [`@classic` decorator](https://github.com/pzuraq/ember-classic-decorator), which helps with transitioning Ember Octane |
3535
| `--type` / `type` | `'services' \| 'routes' \| 'components' \| 'controllers' \| undefined`' | `undefined` | Apply transformation to only passed type. If `undefined, will match all types in path. |
3636
| `--quote` / `quote` | `'single' \| 'double'` | `'single'` | Whether to use double or single quotes by default for new statements that are added during the codemod. |
37-
| `--partial-transforms` / `partialTransforms` | `boolean` | `true` | If `false`, the entire file will fail validation if any EmberObject within it fails validation. |
3837
| `--ignore-leaking-state` / `ignoreLeakingState` | `string \| string[] | `['queryParams']` | Allow-list for `ObjectExpression` or `ArrayExpression` properties to ignore issues detailed in [eslint-plugin-ember/avoid-leaking-state-in-ember-objects](https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/avoid-leaking-state-in-ember-objects.md). In the classic class syntax, using arrays and objects as default properties causes their state to "leak" between instances. If you have custom properties where you know that the shared state won't be a problem (for example, read-only configuration values), you can use this config to ignore them. NOTE: Passing this option will override the defaults, so ensure you include `'queryParams'` in the list unless you explicitly wish to disallow it. Pass as a comma-separated string if using as a CLI-option. Otherwise pass as an array of strings. |
3938
| `DecoratorsConfig` | An object with the following properties. | See below. | A list of decorators that are allowed on object literal properties. (Method decorators will always be allowed.) When the codemod finds a field with one of these decorators, it will be translated directly into a class field with the same decorator. Including a decorator in this list means that you believe that the decorator will work correctly on a class field. Pass as a comma-separated string if using as a CLI-option. Otherwise pass as an array of strings. |
4039
| `DecoratorsConfig.inObjectLiterals` | `string \| string[]` | `[]` | Allow-list for decorators currently applied to object literal properties that can be safely applied to class properties. Pass as a comma-separated string if using as a CLI-option. Otherwise pass as an array of strings. NOTE: Decorators on object methods will be allowed by default. |

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"deepmerge-ts": "^4.3.0",
5454
"ember-codemods-telemetry-helpers": "^3.0.0",
5555
"minimatch": "^7.4.6",
56-
"walk-sync": "^3.0.0",
5756
"winston": "^3.8.2",
5857
"zod": "^3.21.4"
5958
},
@@ -64,6 +63,7 @@
6463
"@jest/globals": "^29.5.0",
6564
"@release-it-plugins/lerna-changelog": "^5.0.0",
6665
"@tsconfig/node12": "^1.0.11",
66+
"@types/glob": "^8.1.0",
6767
"@types/jscodeshift": "^0.11.6",
6868
"@typescript-eslint/eslint-plugin": "^5.59.1",
6969
"@typescript-eslint/parser": "^5.59.1",
@@ -75,6 +75,7 @@
7575
"eslint-plugin-node": "^11.1.0",
7676
"eslint-plugin-unicorn": "^46.0.0",
7777
"execa": "^5.1.1",
78+
"glob": "^8.1.0",
7879
"jest": "^29.5.0",
7980
"prettier": "^2.8.8",
8081
"release-it": "^15.10.1",

test/helpers/expect-logs.ts

Lines changed: 0 additions & 118 deletions
This file was deleted.

test/helpers/expect-multiline.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Makes a regexp pattern to match multiline strings. String arguments passed to
3+
* `makeMultilineMatcher` will be escaped then merged together into a regexp
4+
* that will match partial lines of multi-line error messages when paired with
5+
* Jest `expect().toThrow` or `expect.stringMatching`.
6+
*
7+
* @example
8+
* ```
9+
* const expected = makeMultilineMatcher('Line 1', 'Line 2', '3')
10+
* //=> 'Line 1[\S\s]*Line 2[\S\s]*3'
11+
*
12+
* expect('Line 1\nLine 2\nLine 3').toEqual(expect.stringMatching(expected));
13+
* //=> passes
14+
* ```
15+
*/
16+
export function makeMultilineMatcher(...parts: string[]): string {
17+
return parts.map(escapeRegExp).join('[\\S\\s]*');
18+
}
19+
20+
/**
21+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
22+
*/
23+
function escapeRegExp(string: string): string {
24+
return string.replace(/[$()*+.?[\\\]^{|}]/g, '\\$&'); // $& means the whole matched string
25+
}

0 commit comments

Comments
 (0)