@the-/code
Code formatter of the-frameworks
Installation
$ npm install @the-/code --save
Usage
'use strict'
const { TheCode } = require('@the-/code')
async function tryExample() {
const theCode = new TheCode()
await theCode.format('src/**/*.js')
}
tryExample().catch((err) => console.error(err))
API Guide
- astHelper
- module:@the-/code
- module:@the-/code.ast
- module:@the-/code.ast.nodes
- .addExtOnRequireDeclarationArgumentNode()
- .calcNumericOperationOnBinaryExpressionNode()
- .cleanupEmptyArrayPatternParamsOnFunctionNode()
- .cleanupEmptyLineBetweenPropertiesOnObjectExpressionNode()
- .cleanupEmptyObjectPatternParamsOnFunctionNode()
- .cleanupExtOnImportDeclarationNode()
- .cleanupExtOnRequireDeclarationArgumentNode()
- .cleanupRedundantAliasOnObjectPatternNode()
- .cleanupRedundantAliasOnObjectPatternNode()
- .cleanupRedundantArrayPatternOnArrayExpression()
- .cleanupRedundantObjectPatternOnObjectExpression()
- .cleanupReturnAwaitOnFunctionNode()
- .cleanupUnusedOnArrayPatternNode()
- .cleanupUnusedOnFunctionArgumentNode()
- .cleanupUnusedOnImportNode()
- .cleanupUnusedOnObjectPatternNode()
- .cleanupUnusedOnVariableNode()
- .combineObjectPatternOnStatementNode()
- .combinePropertiesOnObjectPattern()
- .commentModuleOnProgramNode()
- .completeJSDocAnnotationsOnCommentNode()
- .findJSDocAnnotationsInCommendNode(CommentNode)
- .findRequireDeclarationOnProgramNode(ProgramNode)
- .formatJSDocCommentOnCommentNode()
- .mergeDuplicateImportOnProgramNode()
- .mergeStringConcatenateOnBinaryExpressionNode()
- .modifyNodeDeprecatedOnRequireDeclaration(Declaration,options=)
- .modifyToDestructorOnDeclarationNode()
- .normalizeAssignmentOnVariableDeclarationNode()
- .normalizeBinaryExpressionNode()
- .normalizeFunctionReturnOnFunctionNode()
- .normalizeJSDocAnnotationsOnCommentNode()
- .normalizeKindOnVariableDeclarationNode()
- .normalizeSrcPathOnImportDeclarationNode()
- .normalizeSrcPathOnRequireArgumentNode()
- .normalizeVariableDeclaratorOnStatementNode()
- .sortAnnotationsOnCommentNode()
- .sortCasesOnSwitchStatementNode()
- .sortExportNamedDeclarationsOnProgramNode()
- .sortMethodsOnClassNode()
- .sortPropertiesOnObjectNode()
- .sortSpecifiersOnImportDeclarationNode()
- .spaceOnCommentNode(CommentNode,options=)
- module:@the-/code.constants
- module:@the-/code.parsers
- module:@the-/code.processors
- .processComment(content)
- .processCSSProp(content)
- .processCSSRule(content)
- .processFileEnd(content)
- .processJSArray(content)
- .processJSBinaryExpression(content)
- .processJSBlock(content)
- .processJSChaining(content,options=)
- .processJSClass(content)
- .processJSDeclaration(content,options=)
- .processJSDoc(options,content)
- .processJSExport(content)
- .processJSFunction(content)
- .processJSIf(content)
- .processJSImport(content)
- .processJSObject(content)
- .processJSON(content,options=)
- .processJSPrettier(content)
- .processJSRedundant(content)
- .processJSRequire(content,options)
- .processJSStrict(content,options)
- .processJSString(content)
- .processJSSwitch(content)
- .processJSUnused(content)
- .processJSXAttribute(content)
- .processJSXExpression(content)
- .processPackageJSON(content,options=)
- .processPackageLockJSON(content,options=)
- .processYAML(content,options)
- TheCode
See API Guide for more detail
License
This software is released under the MIT License.