Skip to content

Commit cb18848

Browse files
committed
fix(parser): use shorthand object properties in service calls
1 parent 9b7de55 commit cb18848

28 files changed

+258
-261
lines changed

.eslintignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dist
2+
node_modules
23
samples
3-
test/generated
44
test/e2e/generated
5-
node_modules
5+
test/generated

.eslintrc.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,25 @@
77
],
88
"env": {
99
"es6": true,
10-
"node": true,
11-
"jest": true
10+
"jest": true,
11+
"node": true
1212
},
1313
"plugins": ["simple-import-sort"],
1414
"rules": {
15+
"@typescript-eslint/ban-ts-comment": 0,
16+
"@typescript-eslint/ban-ts-ignore": 0,
17+
"@typescript-eslint/explicit-function-return-type": 0,
18+
"@typescript-eslint/explicit-module-boundary-types": 0,
1519
"@typescript-eslint/no-explicit-any": 0,
1620
"@typescript-eslint/no-inferrable-types": 0,
1721
"@typescript-eslint/no-non-null-assertion": 0,
1822
"@typescript-eslint/no-var-requires": 0,
19-
"@typescript-eslint/ban-ts-ignore": 0,
20-
"@typescript-eslint/ban-ts-comment": 0,
21-
"@typescript-eslint/explicit-function-return-type": 0,
22-
"@typescript-eslint/explicit-module-boundary-types": 0,
23-
"sort-imports": "off",
23+
"arrow-body-style": "error",
2424
"import/order": "off",
25-
"simple-import-sort/imports": "error",
25+
"object-shorthand": "error",
26+
"prettier/prettier": ["error"],
2627
"simple-import-sort/exports": "error",
27-
"prettier/prettier": ["error"]
28+
"simple-import-sort/imports": "error",
29+
"sort-imports": "off"
2830
}
2931
}

.prettierrc.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"semi": true,
3-
"singleQuote": true,
4-
"trailingComma": "es5",
52
"arrowParens": "avoid",
63
"printWidth": 120,
7-
"tabWidth": 4
4+
"semi": true,
5+
"singleQuote": true,
6+
"tabWidth": 4,
7+
"trailingComma": "es5"
88
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ $ openapi --help
7171

7272
## Formatting
7373

74-
If you use Prettier, your client will be automatically formatted according to your configuration. To disable automatic formatting, run
74+
By default, your client will be automatically formatted according to your configuration. To disable automatic formatting, run
7575

7676
```sh
7777
openapi -i path/to/openapi.json -o src/client --no-autoformat
7878
```
7979

80-
To prevent your client from being processed by linters and similar tools, you should add your output path to the tool's ignore file (e.g. `.eslintignore`).
80+
You can also prevent your client from being processed by formatters and linters by adding your output path to the tool's ignore file (e.g. `.eslintignore`, `.prettierignore`).
8181

8282
## Contributing
8383

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@
4242
"types/index.d.ts"
4343
],
4444
"scripts": {
45-
"clean": "rimraf ./dist ./test/generated ./test/e2e/generated ./samples/generated ./coverage ./node_modules/.cache",
46-
"build": "rollup --config --environment NODE_ENV:development",
4745
"build:watch": "rollup --config --environment NODE_ENV:development --watch",
46+
"build": "rollup --config --environment NODE_ENV:development",
47+
"clean": "rimraf ./dist ./test/generated ./test/e2e/generated ./samples/generated ./coverage ./node_modules/.cache",
48+
"codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b",
49+
"docker": "docker build -t eeelenbaas/openapi-typescript-codegen .",
50+
"eslint:fix": "eslint . --fix",
51+
"eslint": "eslint .",
52+
"prepare": "npm run clean && npm run release",
4853
"release": "rollup --config --environment NODE_ENV:production",
49-
"validate": "tsc --project tsconfig.json --noEmit",
5054
"run": "node ./test/index.js",
51-
"test": "jest --selectProjects UNIT",
52-
"test:update": "jest --selectProjects UNIT --updateSnapshot",
53-
"test:watch": "jest --selectProjects UNIT --watch",
5455
"test:coverage": "jest --selectProjects UNIT --coverage",
5556
"test:e2e": "jest --selectProjects E2E --runInBand --verbose",
56-
"eslint": "eslint .",
57-
"eslint:fix": "eslint . --fix",
58-
"prepare": "npm run clean && npm run release",
59-
"codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b",
60-
"docker": "docker build -t eeelenbaas/openapi-typescript-codegen ."
57+
"test:update": "jest --selectProjects UNIT --updateSnapshot",
58+
"test:watch": "jest --selectProjects UNIT --watch",
59+
"test": "jest --selectProjects UNIT",
60+
"validate": "tsc --project tsconfig.json --noEmit"
6161
},
6262
"dependencies": {
6363
"@apidevtools/json-schema-ref-parser": "11.5.4",

rollup.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const handlebarsPlugin = () => ({
3030
knownHelpersOnly: true,
3131
knownHelpers: {
3232
camelCase: true,
33+
dataParameters: true,
3334
debugThis: true,
3435
enumKey: true,
3536
enumName: true,

src/openApi/v2/parser/escapeName.spec.ts

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

src/openApi/v2/parser/escapeName.ts

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

src/openApi/v2/parser/getModelProperties.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { Model } from '../../../client/interfaces/Model';
2+
import { escapeName } from '../../../utils/escapeName';
23
import { getPattern } from '../../../utils/getPattern';
34
import type { OpenApi } from '../interfaces/OpenApi';
45
import type { OpenApiSchema } from '../interfaces/OpenApiSchema';
5-
import { escapeName } from './escapeName';
66
import type { getModel } from './getModel';
77
import { getType } from './getType';
88

src/openApi/v3/parser/escapeName.spec.ts

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

0 commit comments

Comments
 (0)