-
Notifications
You must be signed in to change notification settings - Fork 2
use nested ternaries in tests ... with some Prettier lint settings NOT WANTED #85
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
base: master
Are you sure you want to change the base?
Conversation
…dule-init into use-nested-ternaries-in-tests
| extends: standard | ||
| extends: | ||
| - standard | ||
| - plugin:prettier/recommended |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - plugin:prettier/recommended |
eslint 7.16.0 / 7.18.0 with eslint-config-standard (with no Prettier plugin enabled) wants to "fix" the test code like this in multiple places (NOT WANTED):
--- a/tests/init-with-example/init-with-example-with-log.test.js
+++ b/tests/init-with-example/init-with-example-with-log.test.js
@@ -40,8 +40,8 @@ jest.mock('execa', () => (cmd, args, opts) => {
mockCallSnapshot.push({ execa: [cmd, args, opts] })
return cmd === 'git'
? args[1] === 'user.email'
- ? Promise.resolve({ stdout: 'alice@example.com' })
- : Promise.resolve({ stdout: 'Alice' })
+ ? Promise.resolve({ stdout: 'alice@example.com' })
+ : Promise.resolve({ stdout: 'Alice' })
: Promise.resolve()
})eslint 7.19.0 with eslint-config-standard (with no Prettier plugin enabled) wants to "fix" the code like this (NOT WANTED):
diff --git a/main.js b/main.js
index 78a623e..1fdda1e 100644
--- a/main.js
+++ b/main.js
@@ -196,22 +196,22 @@ Promise.resolve().then(async () => {
const { androidPackageId } =
platforms.indexOf('android') !== -1
? await prompt({
- type: 'text',
- name: 'androidPackageId',
- message: 'What is the desired Android package id?',
- initial: 'com.demo',
- validate: androidPackageId => androidPackageId.length > 0
- })
+ type: 'text',
+ name: 'androidPackageId',
+ message: 'What is the desired Android package id?',
+ initial: 'com.demo',
+ validate: androidPackageId => androidPackageId.length > 0
+ })
: { androidPackageId: null }
const { tvosEnabled } =
platforms.indexOf('ios') !== -1
? await prompt({
- type: 'confirm',
- name: 'tvosEnabled',
- message: 'Support Apple tvOS (requires react-native-tvos fork)?',
- initial: false
- })
+ type: 'confirm',
+ name: 'tvosEnabled',
+ message: 'Support Apple tvOS (requires react-native-tvos fork)?',
+ initial: false
+ })
: { tvosEnabled: null }
// THANKS to @react-native-community/bob for the idea
@@ -250,11 +250,11 @@ Promise.resolve().then(async () => {
const { useAppleNetworking } =
platforms.indexOf('ios') !== -1 && !isView
? await prompt({
- type: 'confirm',
- name: 'useAppleNetworking',
- message: 'Generate with sample use of Apple Networking?',
- initial: false
- })
+ type: 'confirm',
+ name: 'useAppleNetworking',
+ message: 'Generate with sample use of Apple Networking?',
+ initial: false
+ })
: { useAppleNetworking: false }
log(INFO, 'It is possible to generate an example app for testing,')
and remove the
curly"Standard JS" exception fromeslintrc.ymlThe drawback is that some "Standard JS" indentation rules need to be turned off to avoid a conflict between "Standard JS" and Prettier(X).
It is highly desired by @brodybits to find a way to resolve the conflict between "Standard JS" and prettierx someday in the future.