MCPcopy
hub / github.com/redwoodjs/graphql / handler

Function handler

packages/cli/src/commands/lint.js:31–63  ·  view source on GitHub ↗
({ path, fix })

Source from the content-addressed store, hash-verified

29}
30
31export const handler = async ({ path, fix }) => {
32 recordTelemetryAttributes({
33 command: 'lint',
34 fix,
35 })
36
37 try {
38 const pathString = path?.join(' ')
39 const result = await execa(
40 'yarn eslint',
41 [
42 fix && '--fix',
43 !pathString && fs.existsSync(getPaths().web.src) && 'web/src',
44 !pathString && fs.existsSync(getPaths().web.config) && 'web/config',
45 !pathString &&
46 fs.existsSync(getPaths().web.storybook) &&
47 'web/.storybook',
48 !pathString && fs.existsSync(getPaths().scripts) && 'scripts',
49 !pathString && fs.existsSync(getPaths().api.src) && 'api/src',
50 pathString,
51 ].filter(Boolean),
52 {
53 cwd: getPaths().base,
54 shell: true,
55 stdio: 'inherit',
56 },
57 )
58
59 process.exitCode = result.exitCode
60 } catch (error) {
61 process.exitCode = error.exitCode ?? 1
62 }
63}

Callers

nothing calls this directly

Calls 3

getPathsFunction · 0.90
existsSyncMethod · 0.65

Tested by

no test coverage detected