-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Reformat all files with new eslint rules
- Loading branch information
Showing
19 changed files
with
724 additions
and
721 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = {sync} | ||
module.exports = { sync }; | ||
|
||
function sync(filename) { | ||
return `/${filename}` | ||
return `/${filename}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
const readFile = jest.fn((filePath, encoding, callback) => { | ||
callback(null, `console.log('this is a mock thing for file: ${filePath}')`) | ||
}) | ||
callback(null, `console.log('this is a mock thing for file: ${filePath}')`); | ||
}); | ||
const writeFile = jest.fn((filePath, contents, callback) => { | ||
callback(null) | ||
}) | ||
callback(null); | ||
}); | ||
|
||
const readFileSync = jest.fn(filePath => { | ||
if (filePath.indexOf('.eslintrc') !== -1) { | ||
return '{ "rules": { "semi": "error" } }' | ||
if (filePath.indexOf(".eslintrc") !== -1) { | ||
return '{ "rules": { "semi": "error" } }'; | ||
} | ||
|
||
if (filePath.indexOf('eslintignore')) { | ||
return '*ignored*\n**/ignored/**\n' | ||
if (filePath.indexOf("eslintignore")) { | ||
return "*ignored*\n**/ignored/**\n"; | ||
} else { | ||
throw new Error('readFileSync mock does nto yet handle ', filePath) | ||
throw new Error("readFileSync mock does nto yet handle ", filePath); | ||
} | ||
}) | ||
}); | ||
|
||
const readdirSync = jest.fn(() => { | ||
return [] | ||
}) | ||
return []; | ||
}); | ||
|
||
module.exports = {readFile, writeFile, readFileSync, readdirSync} | ||
module.exports = { readFile, writeFile, readFileSync, readdirSync }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = jest.fn(function mockGetStdin() { | ||
return Promise.resolve(module.exports.stdin) | ||
}) | ||
return Promise.resolve(module.exports.stdin); | ||
}); | ||
|
||
module.exports.stdin = '' | ||
module.exports.stdin = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,70 @@ | ||
module.exports = jest.fn(function mockGlob(globString, options, callback) { | ||
/* eslint complexity:0 */ | ||
if (globString.includes('1')) { | ||
if (globString.includes("1")) { | ||
callback(null, [ | ||
fredProject('index.js'), | ||
fredProject('start.js'), | ||
fredProject('stop/index.js'), | ||
fredProject('stop/log.js'), | ||
]) | ||
} else if (globString.includes('2')) { | ||
fredProject("index.js"), | ||
fredProject("start.js"), | ||
fredProject("stop/index.js"), | ||
fredProject("stop/log.js") | ||
]); | ||
} else if (globString.includes("2")) { | ||
callback(null, [ | ||
fredProject('index.js'), | ||
fredProject('start.js'), | ||
fredProject('continue/index.js'), | ||
fredProject('continue/forever.js'), | ||
]) | ||
} else if (globString.includes('node_modules')) { | ||
fredProject("index.js"), | ||
fredProject("start.js"), | ||
fredProject("continue/index.js"), | ||
fredProject("continue/forever.js") | ||
]); | ||
} else if (globString.includes("node_modules")) { | ||
callback(null, [ | ||
fredProject('foo/node_modules/stuff1.js'), | ||
fredProject('foo/node_modules/stuff2.js'), | ||
fredProject('foo/node_modules/stuff3.js'), | ||
]) | ||
} else if (globString.includes('files-with-syntax-errors')) { | ||
fredProject("foo/node_modules/stuff1.js"), | ||
fredProject("foo/node_modules/stuff2.js"), | ||
fredProject("foo/node_modules/stuff3.js") | ||
]); | ||
} else if (globString.includes("files-with-syntax-errors")) { | ||
callback(null, [ | ||
fredProject('syntax-error1.js'), | ||
fredProject('syntax-error2.js'), | ||
]) | ||
} else if (globString.includes('no-match')) { | ||
callback(null, []) | ||
} else if (globString.includes('throw-error')) { | ||
callback(new Error('something weird happened')) | ||
} else if (globString.includes('no-change')) { | ||
fredProject("syntax-error1.js"), | ||
fredProject("syntax-error2.js") | ||
]); | ||
} else if (globString.includes("no-match")) { | ||
callback(null, []); | ||
} else if (globString.includes("throw-error")) { | ||
callback(new Error("something weird happened")); | ||
} else if (globString.includes("no-change")) { | ||
callback(null, [ | ||
fredProject('no-change/1.js'), | ||
fredProject('no-change/2.js'), | ||
fredProject('no-change/3.js'), | ||
]) | ||
} else if (globString.includes('ignored')) { | ||
fredProject("no-change/1.js"), | ||
fredProject("no-change/2.js"), | ||
fredProject("no-change/3.js") | ||
]); | ||
} else if (globString.includes("ignored")) { | ||
callback(null, [ | ||
fredProject('ignored1.js'), | ||
fredProject('ignored2.js'), | ||
fredProject('ignored3.js'), | ||
fredProject('applied4.js'), | ||
]) | ||
} else if (globString.includes('no-eslint-ignore')) { | ||
fredProject("ignored1.js"), | ||
fredProject("ignored2.js"), | ||
fredProject("ignored3.js"), | ||
fredProject("applied4.js") | ||
]); | ||
} else if (globString.includes("no-eslint-ignore")) { | ||
callback(null, [ | ||
barneyProject('no-ignore/1.js'), | ||
barneyProject('no-ignore/2.js'), | ||
barneyProject('no-ignore/3.js'), | ||
]) | ||
} else if (globString.includes('eslint-config-error')) { | ||
barneyProject("no-ignore/1.js"), | ||
barneyProject("no-ignore/2.js"), | ||
barneyProject("no-ignore/3.js") | ||
]); | ||
} else if (globString.includes("eslint-config-error")) { | ||
callback(null, [ | ||
fredProject('eslint-config-error/1.js'), | ||
fredProject('eslint-config-error/2.js'), | ||
]) | ||
fredProject("eslint-config-error/1.js"), | ||
fredProject("eslint-config-error/2.js") | ||
]); | ||
} else { | ||
throw new Error( | ||
`Your test globString: "${globString}"` + | ||
` doesn't have associated mock data.`, | ||
) | ||
` doesn't have associated mock data.` | ||
); | ||
} | ||
}) | ||
}); | ||
|
||
function fredProject(path) { | ||
return `/Users/fredFlintstone/Developer/top-secret/footless-carriage/${path}` | ||
return `/Users/fredFlintstone/Developer/top-secret/footless-carriage/${path}`; | ||
} | ||
|
||
function barneyProject(path) { | ||
return `/Users/barneyRubble/Developer/top-secret/tesla/${path}` | ||
return `/Users/barneyRubble/Developer/top-secret/tesla/${path}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.