File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
modules/material-parser/scripts Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,10 @@ const fs = require('fs');
33const path = require ( 'path' ) ;
44const Ajv = require ( 'ajv' ) ;
55const { compile } = require ( 'json-schema-to-typescript' ) ;
6+ const { ESLint } = require ( 'eslint' ) ;
67
78const ajv = new Ajv ( ) ;
9+ const eslint = new ESLint ( { fix : true } ) ;
810
911const YamlPath = path . resolve ( __dirname , '../schemas/schema.yml' ) ;
1012const JsonPath = path . resolve ( __dirname , '../src/validate/schema.json' ) ;
@@ -19,9 +21,15 @@ const tsPath = path.resolve(__dirname, '../src/core/schema/types.ts');
1921 console . log ( 'yaml file is successfully transformed into json' ) ;
2022 const ts = await compile ( schema , 'ComponentMeta' ) ;
2123 fs . writeFileSync ( tsPath , ts ) ;
22- console . log ( 'schema.d.ts is successfully generated' ) ;
24+ // Lint files. This doesn't modify target files.
25+ const results = await eslint . lintFiles ( [ tsPath ] ) ;
26+
27+ // Modify the files with the fixed code.
28+ await ESLint . outputFixes ( results ) ;
29+
30+ console . log ( 'schema/types.d.ts is successfully generated' ) ;
2331 } catch ( e ) {
2432 console . log ( e ) ;
2533 process . exit ( 1 ) ;
2634 }
27- } ) ( ) ;
35+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments