Skip to content

Adds prettier via eslint #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
}
},
"plugins": [
"arca"
"arca",
"prettier"
],
"rules": {
"arca/curly": 2,
"arca/import-align": 2,
"arca/import-ordering": 2,
"arca/newline-after-import-section": 2,
"arca/no-default-export": 2
"arca/no-default-export": 2,
"prettier/prettier": "error"
}
}
161 changes: 161 additions & 0 deletions .pnp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": false,
"printWidth": 120
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@types/dateformat": "^1.0.1",
"@types/emscripten": "^0.0.31",
"@types/eslint": "4.16.6",
"@types/eslint-plugin-prettier": "2.2.0",
"@types/eventemitter3": "^2.0.2",
"@types/execa": "^0.9.0",
"@types/faker": "^4.1.4",
Expand All @@ -29,6 +30,7 @@
"@types/node": "^10.12.0",
"@types/node-emoji": "^1.8.0",
"@types/node-fetch": "^2.1.2",
"@types/prettier": "1.16.3",
"@types/react": "^16.4.14",
"@types/react-redux": "^6.0.9",
"@types/redux-saga": "^0.10.5",
Expand All @@ -45,9 +47,11 @@
"babel-jest": "^24.5.0",
"eslint": "^5.16.0",
"eslint-plugin-arca": "^0.8.1",
"eslint-plugin-prettier": "^3.0.1",
"jest": "^24.5.0",
"jest-environment-node": "^24.5.0",
"jest-junit": "^5.2.0",
"prettier": "^1.17.0",
"ts-node": "^7.0.1",
"typescript": "^3.3.3333"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/berry-cli/sources/WorkspaceRequiredError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export class WorkspaceRequiredError extends UsageError {
constructor(cwd: string) {
super(`This command can only be run from within a workspace of your project.`);
}
}
}
41 changes: 24 additions & 17 deletions packages/berry-cli/sources/cli.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import {Configuration} from '@berry/core';
import {xfs, NodeFS} from '@berry/fslib';
import {execFileSync} from 'child_process';
import {Configuration} from '@berry/core';
import {xfs, NodeFS} from '@berry/fslib';
import {execFileSync} from 'child_process';
import {UsageError, Clipanion} from 'clipanion';
import {posix} from 'path';
import * as yup from 'yup';
import {posix} from 'path';
import * as yup from 'yup';

import {pluginConfiguration} from './pluginConfiguration';
import {pluginConfiguration} from './pluginConfiguration';

const clipanion = new Clipanion({configKey: null});

clipanion.topLevel(`[--cwd PATH]`)
.validate(yup.object().shape({
clipanion.topLevel(`[--cwd PATH]`).validate(
yup.object().shape({
cwd: yup.string().transform((cwd = process.cwd()) => {
// Note that the `--cwd` option might be a relative path that we need to resolve
return posix.resolve(NodeFS.toPortablePath(process.cwd()), NodeFS.toPortablePath(cwd));
}),
}));
}),
);

function runBinary(path: string) {
const physicalPath = NodeFS.fromPortablePath(path);
Expand All @@ -24,17 +25,17 @@ function runBinary(path: string) {
execFileSync(process.execPath, [physicalPath, ...process.argv.slice(2)], {
stdio: `inherit`,
env: {
... process.env,
...process.env,
YARN_IGNORE_PATH: `1`,
}
},
});
} else {
execFileSync(physicalPath, process.argv.slice(2), {
stdio: `inherit`,
env: {
... process.env,
...process.env,
YARN_IGNORE_PATH: `1`,
}
},
});
}
}
Expand All @@ -47,7 +48,14 @@ async function run() {

if (yarnPath !== null && !ignorePath) {
if (!xfs.existsSync(yarnPath)) {
clipanion.error(new Error(`The "yarn-path" option has been set (in ${configuration.sources.get(`yarnPath`)}), but the specified location doesn't exist (${yarnPath}).`), {stream: process.stderr});
clipanion.error(
new Error(
`The "yarn-path" option has been set (in ${configuration.sources.get(
`yarnPath`,
)}), but the specified location doesn't exist (${yarnPath}).`,
),
{stream: process.stderr},
);
process.exitCode = 1;
} else {
try {
Expand All @@ -58,11 +66,10 @@ async function run() {
}
} else {
for (const plugin of configuration.plugins.values())
for (const command of plugin.commands || [])
command(clipanion, pluginConfiguration);
for (const command of plugin.commands || []) command(clipanion, pluginConfiguration);

clipanion.runExit(`yarn`, process.argv.slice(2), {
cwd: NodeFS.toPortablePath(process.cwd())
cwd: NodeFS.toPortablePath(process.cwd()),
});
}
}
Expand Down
Loading