Skip to content

Commit

Permalink
Better eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
markmur committed Oct 25, 2024
1 parent cbde3ac commit 1bcab6a
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 30 deletions.
34 changes: 34 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const path = require('path');

const modulePath = 'modules/@shopify/checkout-sheet-kit';
const moduleAbsolutePath = path.join(__dirname, modulePath);

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: '@react-native',
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'no-console': 'error',
},
overrides: [
// Sample app files
{
files: ['sample/**/*.ts', 'sample/**/*.tsx'],
rules: {
'no-console': 'off',
'@typescript-eslint/no-shadow': 'off',
},
},
// Module files
{
files: [
path.join(modulePath, 'src/**/*.ts'),
path.join(modulePath, 'src/**/*.tsx'),
],
parserOptions: {
project: path.join(moduleAbsolutePath, 'tsconfig.build.json'),
},
},
],
};
1 change: 1 addition & 0 deletions modules/@shopify/checkout-sheet-kit/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib
6 changes: 3 additions & 3 deletions modules/@shopify/checkout-sheet-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@shopify/checkout-sheet-kit",
"license": "MIT",
"version": "3.2.0",
"version": "3.1.0",
"main": "lib/commonjs/index.js",
"types": "src/index.ts",
"source": "src/index.ts",
Expand All @@ -16,7 +16,7 @@
"clean": "rm -rf lib",
"build": "bob build",
"lint:swift": "./../../../sample/ios/Pods/SwiftLint/swiftlint --strict --quiet ios",
"lint": "yarn typecheck && eslint src",
"lint": "yarn typecheck && eslint .",
"typecheck": "tsc --noEmit"
},
"files": [
Expand Down Expand Up @@ -49,7 +49,7 @@
},
"devDependencies": {
"react-native-builder-bob": "^0.23.1",
"typescript": "^5.6.3"
"typescript": "5.5.2"
},
"react-native-builder-bob": {
"source": "src",
Expand Down
11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"react-test-renderer": "18.3.1",
"ts-jest": "^29.2.5",
"turbo": "^1.10.16",
"typescript": "^5.6.3"
"typescript": "5.5.2"
},
"engines": {
"node": ">=18"
Expand All @@ -74,14 +74,5 @@
"shopify",
"checkout"
],
"eslintConfig": {
"root": true,
"extends": "@react-native",
"rules": {
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/consistent-type-imports": "error",
"no-console": "error"
}
},
"packageManager": "yarn@4.4.1"
}
5 changes: 0 additions & 5 deletions sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,5 @@
},
"engines": {
"node": ">= 18"
},
"eslintConfig": {
"rules": {
"no-console": "off"
}
}
}
2 changes: 1 addition & 1 deletion sample/react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path');
import path from 'path';

const root = path.resolve(__dirname, '..');

Expand Down
1 change: 0 additions & 1 deletion sample/src/screens/CartScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import Icon from 'react-native-vector-icons/Entypo';
import {useShopifyCheckoutSheet} from '@shopify/checkout-sheet-kit';
import useShopify from '../hooks/useShopify';

// eslint-disable-next-line @typescript-eslint/consistent-type-imports
import type {CartLineItem, CartItem} from '../../@types';
import type {Colors} from '../context/Theme';
import {useTheme} from '../context/Theme';
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4445,7 +4445,7 @@ __metadata:
resolution: "@shopify/checkout-sheet-kit@workspace:modules/@shopify/checkout-sheet-kit"
dependencies:
react-native-builder-bob: "npm:^0.23.1"
typescript: "npm:^5.6.3"
typescript: "npm:5.5.2"
peerDependencies:
react: "*"
react-native: "*"
Expand Down Expand Up @@ -5759,7 +5759,7 @@ __metadata:
react-test-renderer: "npm:18.3.1"
ts-jest: "npm:^29.2.5"
turbo: "npm:^1.10.16"
typescript: "npm:^5.6.3"
typescript: "npm:5.5.2"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -12374,23 +12374,23 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:^5.6.3":
version: 5.6.3
resolution: "typescript@npm:5.6.3"
"typescript@npm:5.5.2":
version: 5.5.2
resolution: "typescript@npm:5.5.2"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/44f61d3fb15c35359bc60399cb8127c30bae554cd555b8e2b46d68fa79d680354b83320ad419ff1b81a0bdf324197b29affe6cc28988cd6a74d4ac60c94f9799
checksum: 10c0/8ca39b27b5f9bd7f32db795045933ab5247897660627251e8254180b792a395bf061ea7231947d5d7ffa5cb4cc771970fd4ef543275f9b559f08c9325cccfce3
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A^5.6.3#optional!builtin<compat/typescript>":
version: 5.6.3
resolution: "typescript@patch:typescript@npm%3A5.6.3#optional!builtin<compat/typescript>::version=5.6.3&hash=8c6c40"
"typescript@patch:typescript@npm%3A5.5.2#optional!builtin<compat/typescript>":
version: 5.5.2
resolution: "typescript@patch:typescript@npm%3A5.5.2#optional!builtin<compat/typescript>::version=5.5.2&hash=379a07"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/7c9d2e07c81226d60435939618c91ec2ff0b75fbfa106eec3430f0fcf93a584bc6c73176676f532d78c3594fe28a54b36eb40b3d75593071a7ec91301533ace7
checksum: 10c0/a7b7ede75dc7fc32a76d0d0af6b91f5fbd8620890d84c906f663d8783bf3de6d7bd50f0430b8bb55eac88a38934af847ff709e7156e5138b95ae94cbd5f73e5b
languageName: node
linkType: hard

Expand Down

0 comments on commit 1bcab6a

Please sign in to comment.