You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
registerParser({name: 'foo',pattern: /\.json$/g,parser: ()=>{}});// add name prop, parse -> parserregisterPreprocessor({name: 'foo',preprocessor: ()=>{}});// no changeregisterTransform({name: 'foo',type: 'name',transform: ()=>{}});// transformer -> transformregisterTransformGroup({name: 'foo',transforms: []});// no changeregisterFormat({name: 'foo',format: ()=>{}});// formatter -> formatregisterFilter({name: 'foo',filter: ()=>{}});// no changeregisterFileHeader({name: 'foo',fileHeader: ()=>{}});// no changeregisterAction({name: 'foo',do: ()=>{},undo: ()=>{}});// no changehooks.parsers={};// scoped to hooks object & changed to keyed objecthooks.preprocessors={};// scoped to hooks objecthooks.transforms={};// scoped to hooks object & changed to pluralhooks.transformGroups={};// scoped to hooks object & changed to plural hooks.formats={};// scoped to hooks object & changed to pluralhooks.filters={};// scoped to hooks object & changed to pluralhooks.fileHeaders={};// scoped to hooks object & changed to pluralhooks.actions={};// scoped to hooks object & changed to plural
Also, registered parsers don't just run by default because they're registered, for consistency sake you should apply parsers on the global config level by name, the same way all other hooks are applied:
exportdefault{hooks: {// inline definition of php parser as alternative to `registerParser` methodparsers: {"php-parser": {pattern: /\.php$/,parse: ({ filePath, contents })=>{returnparse(contents);},},},},source: ["**/*.tokens.json"],// applying the parser to this dictionary configparsers: ["php-parser"]}
The text was updated successfully, but these errors were encountered:
Our APIs for registering custom things should be more consistent, it's currently quite confusing and easy to make mistakes due to lack of consistency.
Before:
After:
Also, registered parsers don't just run by default because they're registered, for consistency sake you should apply parsers on the global config level by name, the same way all other hooks are applied:
The text was updated successfully, but these errors were encountered: