Skip to content

Commit ea7fe31

Browse files
committed
refactor: use cameCase for file names, and .spec. for test file names
1 parent b46f572 commit ea7fe31

40 files changed

+49
-46
lines changed
File renamed without changes.

bin/vue-codemod.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as globby from 'globby'
1010
import createDebug from 'debug'
1111

1212
import builtInTransformations from '../transformations'
13-
import runTransformation from '../src/run-transformation'
13+
import runTransformation from '../src/runTransformation'
1414

1515
const debug = createDebug('vue-codemod')
1616
const log = console.log.bind(console)

index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
export { default as VueTransformation } from './src/VueTransformation'
44

5-
export { default as runTransformation } from './src/run-transformation'
5+
export { default as runTransformation } from './src/runTransformation'
66

77
export { default as transformations } from './transformations'

src/__tests__/run-transformation-test.ts src/__tests__/runTransformation.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @ts-nocheck
22
/* eslint-env jest */
33
import type { Transform } from 'jscodeshift'
4-
import runTransformation from '../run-transformation'
4+
import runTransformation from '../runTransformation'
55

66
const unreachableTransform: Transform = () => {
77
throw new Error('This transform should never be invoked')
File renamed without changes.
File renamed without changes.

transformations/__tests__/define-component-test.ts transformations/__tests__/define-component.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jest.autoMockOff()
33
import * as fs from 'fs'
44
import * as path from 'path'
55
import { defineInlineTest } from 'jscodeshift/src/testUtils'
6-
import runTransformation from '../../src/run-transformation'
6+
import runTransformation from '../../src/runTransformation'
77

88
const transform = require('../define-component')
99

transformations/add-import.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33
import type {
44
ImportSpecifier,
55
ImportDefaultSpecifier,

transformations/define-component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
import { transformAST as addImport } from './add-import'
55
import { transformAST as removeExtraneousImport } from './remove-extraneous-import'

transformations/import-composition-api-from-vue.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// this file is served as a boilerplate template for writing more complex transformations
2-
import wrap from '../src/wrap-ast-transformation'
3-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
2+
import wrap from '../src/wrapAstTransformation'
3+
import type { ASTTransformation } from '../src/wrapAstTransformation'
44

55
// TODO: SetupContext.refs does not exist in Vue 3.0
66
export const transformAST: ASTTransformation = ({ root, j }) => {

transformations/new-directive-api.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
const hookNameMap: { [key: string]: string } = {
55
bind: 'beforeMount',

transformations/new-global-api.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
import { transformAST as vueAsNamespaceImport } from './vue-as-namespace-import'
55
import { transformAST as importCompositionApiFromVue } from './import-composition-api-from-vue'

transformations/new-vue-to-create-app.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
import type * as N from 'jscodeshift'
55

transformations/noop.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// this file is served as a boilerplate template for writing more complex transformations
2-
import wrap from '../src/wrap-ast-transformation'
3-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
2+
import wrap from '../src/wrapAstTransformation'
3+
import type { ASTTransformation } from '../src/wrapAstTransformation'
44

55
export const transformAST: ASTTransformation = (context) => {}
66

transformations/remove-contextual-h-from-render.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ArrowFunctionExpression } from 'jscodeshift'
22

3-
import wrap from '../src/wrap-ast-transformation'
4-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
3+
import wrap from '../src/wrapAstTransformation'
4+
import type { ASTTransformation } from '../src/wrapAstTransformation'
55

66
import { transformAST as addImport } from './add-import'
77

transformations/remove-extraneous-import.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33
import type {
44
ImportSpecifier,
55
ImportDefaultSpecifier,

transformations/remove-production-tip.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
export const transformAST: ASTTransformation = ({ root, j }) => {
55
const productionTipAssignment = root.find(

transformations/remove-trivial-root.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
import type * as N from 'jscodeshift'
55

transformations/remove-vue-use.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* So we now expect the migration to be done in the `root-prop-to-use` transformation,
88
* and the `Vue.use` statements can be just abandoned.
99
*/
10-
import wrap from '../src/wrap-ast-transformation'
11-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
10+
import wrap from '../src/wrapAstTransformation'
11+
import type { ASTTransformation } from '../src/wrapAstTransformation'
1212
import { transformAST as removeExtraneousImport } from './remove-extraneous-import'
1313

1414
type Params = {

transformations/root-prop-to-use.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
import * as N from 'jscodeshift'
55

transformations/scoped-slots-to-slots.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
import type * as N from 'jscodeshift'
55

transformations/vue-as-namespace-import.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
// import Vue from 'vue' -> import * as Vue from 'vue'
55
export const transformAST: ASTTransformation = ({ j, root }) => {

transformations/vue-class-component-v8.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
// import { Component } from 'vue-class-component' ->
55
// import { Options as Component } from 'vue-class-component'
@@ -8,15 +8,18 @@ export const transformAST: ASTTransformation = (context) => {
88

99
const vueClassComponentImportDecls = root.find(j.ImportDeclaration, {
1010
source: {
11-
value: 'vue-class-component'
12-
}
11+
value: 'vue-class-component',
12+
},
1313
})
1414

15-
const ComponentImportSpec = vueClassComponentImportDecls.find(j.ImportSpecifier, {
16-
imported: {
17-
name: 'Component'
15+
const ComponentImportSpec = vueClassComponentImportDecls.find(
16+
j.ImportSpecifier,
17+
{
18+
imported: {
19+
name: 'Component',
20+
},
1821
}
19-
})
22+
)
2023

2124
ComponentImportSpec.replaceWith(({ node }) => {
2225
return j.importSpecifier(j.identifier('Options'), j.identifier('Component'))

transformations/vue-router-v4.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
import { transformAST as addImport } from './add-import'
55
import { transformAST as removeExtraneousImport } from './remove-extraneous-import'

transformations/vuex-v4.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import wrap from '../src/wrap-ast-transformation'
2-
import type { ASTTransformation } from '../src/wrap-ast-transformation'
1+
import wrap from '../src/wrapAstTransformation'
2+
import type { ASTTransformation } from '../src/wrapAstTransformation'
33

44
import { transformAST as addImport } from './add-import'
55
import { transformAST as removeExtraneousImport } from './remove-extraneous-import'

0 commit comments

Comments
 (0)