Skip to content

Commit 510ba18

Browse files
authored
Update lint-related dependencies and configuration (#2761)
* Remove unnecessary babel deps * arrow-functions and shorthand-properties are brought in by babel-preset-expo * template-literals is only brought in by babel/preset-env, which babel-preset-expo doesn't use, but for now we do * Configure expo default prettier * Set up eslintignore Should primarily use eslintignore, but prettierignore is useful if running prettier w/o eslint * Rework package.json commands Eslint is running prettier now, so just pass that to "--fix". It's a little weird that "lint" was running format, up for discussion about what each should do. * Update config files to match lint rules Was ignored by linting before. Ignoring files may be useful if they are part of a template, and we never plan to customize the file; but if we do, linters may be useful for catching bugs. * Disable included array type rule We weren't using it previously. Causes errors like this: /Users/lizzi/dev/igniteTests/DepsFixing/app/utils/useSafeAreaInsetsStyle.ts 21:17 warning Array type using 'Array<ExtendedEdge>' is forbidden. Use 'ExtendedEdge[]' instead @typescript-es lint/array-type 21:39 warning Array type using 'Array<ExtendedEdge>' is forbidden. Use 'ExtendedEdge[]' instead @typescript-es lint/array-type 35:17 warning Array type using 'Array<ExtendedEdge>' is forbidden. Use 'ExtendedEdge[]' instead @typescript-es lint/array-type * Format files according to prettier These files were previously excluded, but I don't see why they should be * Fix rules of hooks issues * useRef for Animated.Value useRef is more appropriate when we have an Animated.Value and don't want components/hooks to react to state, and avoids exhaustive-deps issue * exhaustive-deps fixes * Importing React is no longer required for TSX/JSX * Re-add previous lint config One new addition: use quotes consistently in objects where at least one key requires quotes. * Format code after markup removal * Fix inconsistent indentation in messages * Add restricted imports rule to ensure consistent importing of React API * Update cli prettier to match boilerplate * Update typescript and typescript eslint tree... then leads to updating more eslint * Match quoteProps configuration of boilerplate * typescript-estree requires later version of node update to LTS on CI * Use consistent spacing on new command * Re-add react-native linter, PR feedback
1 parent ddfc17a commit 510ba18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+647
-674
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
defaults: &defaults
77
docker:
88
# Choose the version of Node you want here
9-
- image: cimg/node:18.17.1
9+
- image: cimg/node:20.17.0
1010
working_directory: /mnt/ramdisk/repo
1111

1212
version: 2.1

boilerplate/.eslintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
ios
3+
android
4+
.expo
5+
.vscode
6+
ignite/ignite.json
7+
package.json
8+
.eslintignore

boilerplate/.eslintrc.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// https://docs.expo.dev/guides/using-eslint/
2+
module.exports = {
3+
extends: [
4+
"standard",
5+
"plugin:@typescript-eslint/recommended",
6+
"plugin:react/recommended",
7+
"plugin:react-native/all",
8+
// `expo` must come after `standard` or its globals configuration will be overridden
9+
"expo",
10+
// `jsx-runtime` must come after `expo` or it will be overridden
11+
"plugin:react/jsx-runtime",
12+
"prettier",
13+
],
14+
plugins: ["reactotron", "prettier"],
15+
rules: {
16+
"prettier/prettier": "error",
17+
// typescript-eslint
18+
"@typescript-eslint/array-type": 0,
19+
"@typescript-eslint/ban-ts-comment": 0,
20+
"@typescript-eslint/no-explicit-any": 0,
21+
"@typescript-eslint/no-unused-vars": [
22+
"error",
23+
{
24+
argsIgnorePattern: "^_",
25+
varsIgnorePattern: "^_",
26+
},
27+
],
28+
"@typescript-eslint/no-var-requires": 0,
29+
// eslint
30+
"no-use-before-define": 0,
31+
"no-restricted-imports": [
32+
"error",
33+
{
34+
paths: [
35+
// Prefer named exports from 'react' instead of importing `React`
36+
{
37+
name: "react",
38+
importNames: ["default"],
39+
message: "Import named exports from 'react' instead.",
40+
},
41+
],
42+
},
43+
],
44+
//react-native
45+
"react-native/no-raw-text": 0,
46+
// reactotron
47+
"reactotron/no-tron-in-production": "error",
48+
// eslint-config-standard overrides
49+
"comma-dangle": 0,
50+
"no-global-assign": 0,
51+
"quotes": 0,
52+
"space-before-function-paren": 0,
53+
},
54+
}

boilerplate/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
node_modules
22
ios
33
android
4+
.expo
45
.vscode
56
ignite/ignite.json
67
package.json
8+
.eslintignore

boilerplate/.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 100,
3+
"semi": false,
4+
"singleQuote": false,
5+
"trailingComma": "all",
6+
"quoteProps": "consistent"
7+
}

boilerplate/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import "@expo/metro-runtime"
2-
import React from "react"
32
import * as SplashScreen from "expo-splash-screen"
43
import App from "./app/app"
54

boilerplate/app.config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require("ts-node/register")
88

99
/**
1010
* @param config ExpoConfig coming from the static config app.json if it exists
11-
*
11+
*
1212
* You can read more about Expo's Configuration Resolution Rules here:
1313
* https://docs.expo.dev/workflow/configuration/#configuration-resolution-rules
1414
*/
@@ -17,9 +17,6 @@ module.exports = ({ config }: ConfigContext): Partial<ExpoConfig> => {
1717

1818
return {
1919
...config,
20-
plugins: [
21-
...existingPlugins,
22-
require("./plugins/withSplashScreen").withSplashScreen,
23-
],
20+
plugins: [...existingPlugins, require("./plugins/withSplashScreen").withSplashScreen],
2421
}
2522
}

boilerplate/app/app.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import "./utils/gestureHandler"
2020
import "./i18n"
2121
import "./utils/ignoreWarnings"
2222
import { useFonts } from "expo-font"
23-
import React from "react"
2423
import { initialWindowMetrics, SafeAreaProvider } from "react-native-safe-area-context"
2524
import * as Linking from "expo-linking"
2625
import { useInitialRootStore } from "./models" // @mst remove-current-line

boilerplate/app/components/AutoImage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useLayoutEffect, useState } from "react"
1+
import { useLayoutEffect, useState } from "react"
22
import { Image, ImageProps, ImageURISource, Platform } from "react-native"
33

44
export interface AutoImageProps extends ImageProps {

boilerplate/app/components/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { ComponentType } from "react"
1+
import { ComponentType } from "react"
22
import {
33
Pressable,
44
PressableProps,

0 commit comments

Comments
 (0)