fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #93 from jordanshatford/feat/autoformat-with-eslint

feat(generate): auto format with eslint if available

authored by

Lubos and committed by
GitHub
69506ace 879fe976

+21 -4
+1 -1
.github/workflows/ci.yml
··· 30 30 run: npm run build 31 31 32 32 - name: Run linter 33 - run: npm run eslint 33 + run: npm run lint 34 34 35 35 - name: Run unit tests 36 36 run: npm run test
+1 -1
CONTRIBUTING.md
··· 38 38 2. Create your patch or feature 39 39 3. Ensure the builds work by running: `npm run build` 40 40 4. Ensure the tests will pass by running: `npm run test` 41 - 5. Ensure the code is formatted by running: `npm run eslint:fix` 41 + 5. Ensure the code is formatted by running: `npm run lint:fix` 42 42 6. Commit your changes using a descriptive commit message 43 43 44 44 After your Pull Request is created, it will automatically be build and tested in GitHub actions. Once successful it will be ready for review.
+2 -2
package.json
··· 50 50 "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp", 51 51 "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node", 52 52 "clean": "rimraf dist test/generated test/e2e/generated coverage node_modules/.cache", 53 - "eslint:fix": "eslint . --fix", 54 - "eslint": "eslint .", 53 + "lint:fix": "eslint . --fix", 54 + "lint": "eslint .", 55 55 "prepublishOnly": "npm run build", 56 56 "test": "jest --selectProjects UNIT", 57 57 "test:coverage": "jest --selectProjects UNIT --coverage",
+5
src/index.ts
··· 38 38 console.log('✨ Running Prettier'); 39 39 sync('prettier', ['--ignore-unknown', options.output, '--write', '--ignore-path', './.prettierignore']); 40 40 } 41 + 42 + if (dependencies.eslint) { 43 + console.log('✨ Running Eslint'); 44 + sync('eslint', [options.output, '--fix', '--quiet', '--ignore-path', './.eslintignore']); 45 + } 41 46 }; 42 47 43 48 const inferClient = (dependencies: Dependencies): Config['client'] => {
+12
test/bin.spec.ts
··· 146 146 expect(result.stderr.toString()).toBe(''); 147 147 }); 148 148 149 + it('auto fixs output with Eslint', async () => { 150 + const result = sync('node', [ 151 + './bin/index.js', 152 + '--input', 153 + './test/spec/v3.json', 154 + '--output', 155 + './test/generated/bin', 156 + ]); 157 + expect(result.stdout.toString()).toContain('Eslint'); 158 + expect(result.stderr.toString()).toBe(''); 159 + }); 160 + 149 161 it('throws error without parameters', async () => { 150 162 const result = sync('node', ['./bin/index.js', '--no-write']); 151 163 expect(result.stdout.toString()).toBe('');