Skip to content

Commit

Permalink
fix: linting and d3 additions
Browse files Browse the repository at this point in the history
  • Loading branch information
e-younan committed Mar 2, 2024
1 parent 76a230a commit 43743a9
Show file tree
Hide file tree
Showing 22 changed files with 2,483 additions and 330 deletions.
31 changes: 10 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
module.exports = {
root: true,
extends: ['@react-native-community', 'prettier'],
ignorePatterns: ['build'],
extends: ["universe", "universe/native", "universe/web", "prettier"],
env: {
node: true,
},
overrides: [
{
files: ['*.ts', '*.tsx', '*.d.ts'],
files: ["*.ts", "*.tsx", "*.d.ts"],
parserOptions: {
project: './tsconfig.json',
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
sourceType: 'module',
sourceType: "module",
},
},
],
env: {
node: true,
},
rules: {
'prettier/prettier': [
'error',
{
quoteProps: 'consistent',
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
printWidth: 100,
},
],
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
"prettier/prettier": ["error", {}, { usePrettierrc: true }],
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
},
};
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"quoteProps": "consistent",
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"printWidth": 100
}
27 changes: 10 additions & 17 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
module.exports = {
root: true,
extends: ['@react-native-community', 'prettier'],
extends: ["universe", "universe/native", "universe/web", "prettier"],
env: {
node: true,
},
overrides: [
{
files: ['*.ts', '*.tsx', '*.d.ts'],
files: ["*.ts", "*.tsx", "*.d.ts"],
parserOptions: {
project: './tsconfig.json',
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
sourceType: 'module',
sourceType: "module",
},
},
],
rules: {
'prettier/prettier': [
'error',
{
quoteProps: 'consistent',
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
printWidth: 100,
},
],
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
"prettier/prettier": ["error", {}, { usePrettierrc: true }],
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
},
};
8 changes: 8 additions & 0 deletions example/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"quoteProps": "consistent",
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"printWidth": 100
}
2 changes: 1 addition & 1 deletion example/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { Slot } from 'expo-router';
import { Slot } from "expo-router";

export default Slot;
7 changes: 2 additions & 5 deletions example/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { LineChart } from "@codeherence/react-native-graph";
import { useMemo } from "react";
import { View, useWindowDimensions } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";

import { LineChart } from "@codeherence/react-native-graph";
import { Banner } from "../components/Banner";

const GRAPH_HEIGHT_PROPORTION = 0.5;

export default () => {
const { top, bottom } = useSafeAreaInsets();
const { width, height } = useWindowDimensions();
Expand All @@ -20,15 +18,14 @@ export default () => {
style={{
paddingTop: top,
paddingBottom: bottom,
position: "relative",
justifyContent: "center",
alignItems: "center",
}}
>
<LineChart
points={data}
width={width}
height={height * GRAPH_HEIGHT_PROPORTION}
height={height - (top + bottom)}
BannerComponent={Banner}
/>
</View>
Expand Down
8 changes: 1 addition & 7 deletions example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
const path = require("path");
const pak = require("../package.json");

module.exports = function (api) {
api.cache(true);

return {
presets: ["babel-preset-expo"],
plugins: [
"@babel/plugin-proposal-export-namespace-from",
"react-native-reanimated/plugin",
],
plugins: ["@babel/plugin-proposal-export-namespace-from", "react-native-reanimated/plugin"],
};
};
4 changes: 2 additions & 2 deletions example/components/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Text, useFont } from "@shopify/react-native-skia";

const robotoMedium = require("../public/fonts/Roboto/Roboto-Medium.ttf");

export const Banner: React.FC<BannerComponentProps> = (props) => {
export const Banner: React.FC<BannerComponentProps> = ({ text }) => {
const font = useFont(robotoMedium, 24);
return <Text x={0} y={0} font={font} text={props.text} />;
return <Text x={0} y={0} font={font} text={text} />;
};
6 changes: 3 additions & 3 deletions example/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare module '*.svg' {
import React from 'react';
import { SvgProps } from 'react-native-svg';
declare module "*.svg" {
import React from "react";
import { SvgProps } from "react-native-svg";
const content: React.FC<SvgProps>;
export default content;
}
5 changes: 5 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
"@expo/webpack-config": "~19.0.1",
"babel-loader": "^8.1.0",
"babel-plugin-module-resolver": "^4.1.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-universe": "^12.0.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"react-native-svg-transformer": "^1.0.0"
},
"private": true
Expand Down
6 changes: 3 additions & 3 deletions example/path-fs-canvaskit-postinstall.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// To be added in package.json "postinstall": "(...) && node path-fs-canvaskit-postinstall.js"
const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");

const packageJsonPath = path.join(__dirname, 'node_modules', 'canvaskit-wasm', 'package.json');
const packageJsonPath = path.join(__dirname, "node_modules", "canvaskit-wasm", "package.json");
const packageJson = require(packageJsonPath);

packageJson.browser = {
Expand Down
Loading

0 comments on commit 43743a9

Please sign in to comment.