react-native-macos/Libraries/StyleSheet
Tom Underhill 602070f44b Add ES Lint rules for `DynamicColorIOS()`and `ColorAndroid()` (#28398)
Summary:
The [PlatformColor PR](https://github.com/facebook/react-native/pull/27908) added support for iOS and Android to express platform specific color values.   The primary method for an app to specify such colors is via the `PlatformColor()` method that takes string arguments.   The `PlatformColor` method returns an opaque Flow type enforcing that apps use the PlatformColor method instead of creating Objects from scratch -- doing so would make it harder to write static analysis tools around Color values in the future.   But in addition to `PlatformColor()`, iOS has a `DynamicColorIOS()` method that takes an Object.   The Flow type for this Object cannot be opaque, but we still want to enforce that app code doesn't pass variables instead of Object literals or that values in the Objects are variables.   To ensure `DynamicColorIOS()` can be statically analyzed this change adds an ESLint rule to enforce that `DynamicColorIOS()` takes an Object literal of a specific shape.   A `ColorAndroid()` was also introduced not for practical use but just to test having platform specific methods for more than one platform in the same app.   A second ESLint rule is created for `ColorAndroid` as well.

## Changelog

[General] [Changed] - Add ES Lint rules for `DynamicColorIOS()`and `ColorAndroid()`
Pull Request resolved: https://github.com/facebook/react-native/pull/28398

Test Plan: `yarn lint` passes.

Reviewed By: cpojer

Differential Revision: D20685383

Pulled By: TheSavior

fbshipit-source-id: 9bb37ccc059e74282b119577df0ced63cb9b1f53
2020-03-27 23:02:15 -07:00
..
__flowtests__ Back out "Upgrade Prettier from 1.17 to 2.0.2." 2020-03-24 21:47:35 -07:00
__tests__ Add ES Lint rules for `DynamicColorIOS()`and `ColorAndroid()` (#28398) 2020-03-27 23:02:15 -07:00
EdgeInsetsPropType.js Do not explicitly include ".js" in Library imports (#28311) 2020-03-17 02:11:53 -07:00
PlatformColorValueTypes.android.js PlatformColor implementations for iOS and Android (#27908) 2020-03-02 15:12:09 -08:00
PlatformColorValueTypes.ios.js PlatformColor implementations for iOS and Android (#27908) 2020-03-02 15:12:09 -08:00
PlatformColorValueTypesAndroid.android.js PlatformColor implementations for iOS and Android (#27908) 2020-03-02 15:12:09 -08:00
PlatformColorValueTypesAndroid.js PlatformColor implementations for iOS and Android (#27908) 2020-03-02 15:12:09 -08:00
PlatformColorValueTypesIOS.ios.js PlatformColor implementations for iOS and Android (#27908) 2020-03-02 15:12:09 -08:00
PlatformColorValueTypesIOS.js PlatformColor implementations for iOS and Android (#27908) 2020-03-02 15:12:09 -08:00
PointPropType.js Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
Rect.js Pressability: Support Rect or Numeric Size 2020-01-28 15:14:23 -08:00
StyleSheet.js Fix return type of StyleSheet.create to be the identity function 2020-01-02 10:01:15 -08:00
StyleSheetTypes.js Fix outdated urls (#28285) 2020-03-15 22:58:14 -07:00
StyleSheetValidation.js Back out "Upgrade Prettier from 1.17 to 2.0.2." 2020-03-24 21:47:35 -07:00
flattenStyle.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
normalizeColor.js PlatformColor implementations for iOS and Android (#27908) 2020-03-02 15:12:09 -08:00
processColor.js PlatformColor implementations for iOS and Android (#27908) 2020-03-02 15:12:09 -08:00
processColorArray.js PlatformColor implementations for iOS and Android (#27908) 2020-03-02 15:12:09 -08:00
processTransform.js Back out "Upgrade Prettier from 1.17 to 2.0.2." 2020-03-24 21:47:35 -07:00
setNormalizedColorAlpha.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
splitLayoutProps.js Back out "Upgrade Prettier from 1.17 to 2.0.2." 2020-03-24 21:47:35 -07:00