Skip to content

Commit

Permalink
feat: enable eslint in danger
Browse files Browse the repository at this point in the history
  • Loading branch information
Riccardo Cipolleschi committed Aug 2, 2022
1 parent 760c148 commit 673f217
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/danger_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: yarn install
working-directory: .
- run: yarn install
working-directory: bots
- name: Danger
Expand Down
46 changes: 45 additions & 1 deletion bots/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@

'use strict';

const {danger, fail, message, warn} = require('danger');
const {danger, fail, /*message,*/ warn} = require('danger');
const includes = require('lodash.includes');
const {exec} = require('child_process');
const fs = require('fs');
const eslint = require('@seadub/danger-plugin-eslint');

const isFromPhabricator =
danger.github.pr.body &&
Expand Down Expand Up @@ -112,3 +115,44 @@ if (isMergeRefStable) {
},
);
}

eslint.default();
// eslint();

// // ESLINT
// const js_files = danger.git.modified_files.filter(
// name => name.endsWith('.js') || name.endsWith('.jsx'),
// );
// if (js_files.length > 0) {
// const joined_files = js_files.map(name => '../' + name).join(' ');
// exec(
// `
// npx eslint -f json -o /tmp/eslint.output ${joined_files}`,
// (error, stdout, stderr) => {
// try {
// const eslintOutput = fs.readFileSync('/tmp/eslint.output', 'utf8');
// const eslintJSON = JSON.parse(eslintOutput);
// const faultyFiles = eslintJSON.filter(file => file.messages.length > 0);
// let messageText = '';
// faultyFiles.forEach(file => {
// const path = file.filePath;
// const splitPath = path.split('/');
// messageText += `${splitPath[splitPath.length - 1]} - ${path}\n`;

// file.messages.forEach(msg => {
// const emoji =
// msg.severity === 1 ? '⚠️' : msg.severity === 2 ? '⛔️' : '✅';
// const format = `[${msg.line}:${msg.column}] ${emoji} - ${msg.message} (${msg.ruleId})\n`;
// messageText += format;
// });
// messageText += '\n';
// });
// if (messageText.length !== 0) {
// warn(messageText);
// }
// } catch (err) {
// fail(`Couldn't read the lint file output\n${err}`);
// }
// },
// );
// }
1 change: 1 addition & 0 deletions bots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"danger": "node ./node_modules/.bin/danger"
},
"devDependencies": {
"@seadub/danger-plugin-eslint": "^3.0.2",
"danger": "^11.0.2",
"lodash.includes": "^4.3.0",
"minimatch": "^3.0.4"
Expand Down
5 changes: 5 additions & 0 deletions bots/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,11 @@
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=

"@seadub/danger-plugin-eslint@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@seadub/danger-plugin-eslint/-/danger-plugin-eslint-3.0.2.tgz#9a51d9f1a103a274264c30212234001de0b417c1"
integrity sha512-W+efX4mP04A8wMuLV0nV+iOj892Vrbyik+FyDZcGgpzkJFXX0UfDhOPZ0FonbSV0xM47DI5a8go88U/pBdGM2A==

"@types/long@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ function translateTypeAnnotation(
): Nullable<NativeModuleTypeAnnotation> {
const {nullable, typeAnnotation, typeAliasResolutionStatus} =
resolveTypeAnnotation(flowTypeAnnotation, types);
3 == 1
switch (typeAnnotation.type) {
case 'GenericTypeAnnotation': {
switch (typeAnnotation.id.name) {
Expand Down
93 changes: 60 additions & 33 deletions packages/rn-tester/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ PODS:
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- glog (0.3.5)
- hermes-engine (1000.0.0)
- libevent (2.1.12)
- OpenSSL-Universal (1.1.1100)
- RCT-Folly (2021.07.22.00):
Expand All @@ -91,6 +92,12 @@ PODS:
- DoubleConversion
- fmt (~> 6.2.1)
- glog
- RCT-Folly/Futures (2021.07.22.00):
- boost
- DoubleConversion
- fmt (~> 6.2.1)
- glog
- libevent
- RCTRequired (1000.0.0)
- RCTTypeSafety (1000.0.0):
- FBLazyVector (= 1000.0.0)
Expand Down Expand Up @@ -590,6 +597,17 @@ PODS:
- React-graphics (1000.0.0):
- RCT-Folly/Fabric (= 2021.07.22.00)
- React-Core/Default (= 1000.0.0)
- React-hermes (1000.0.0):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2021.07.22.00)
- RCT-Folly/Futures (= 2021.07.22.00)
- React-cxxreact (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-jsiexecutor (= 1000.0.0)
- React-jsinspector (= 1000.0.0)
- React-perflogger (= 1000.0.0)
- React-jsi (1000.0.0):
- boost (= 1.76.0)
- DoubleConversion
Expand Down Expand Up @@ -747,6 +765,8 @@ DEPENDENCIES:
- FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0)
- FlipperKit/SKIOSNetworkPlugin (= 0.125.0)
- glog (from `../../third-party-podspecs/glog.podspec`)
- hermes-engine (from `../../sdks/hermes/hermes-engine.podspec`)
- libevent (~> 2.1.12)
- OpenSSL-Universal (= 1.1.1100)
- RCT-Folly (from `../../third-party-podspecs/RCT-Folly.podspec`)
- RCT-Folly/Fabric (from `../../third-party-podspecs/RCT-Folly.podspec`)
Expand All @@ -763,6 +783,7 @@ DEPENDENCIES:
- React-cxxreact (from `../../ReactCommon/cxxreact`)
- React-Fabric (from `../../ReactCommon`)
- React-graphics (from `../../ReactCommon/react/renderer/graphics`)
- React-hermes (from `../../ReactCommon/hermes`)
- React-jsi (from `../../ReactCommon/jsi`)
- React-jsi/Fabric (from `../../ReactCommon/jsi`)
- React-jsiexecutor (from `../../ReactCommon/jsiexecutor`)
Expand Down Expand Up @@ -817,6 +838,8 @@ EXTERNAL SOURCES:
:path: "../../React/FBReactNativeSpec"
glog:
:podspec: "../../third-party-podspecs/glog.podspec"
hermes-engine:
:podspec: "../../sdks/hermes/hermes-engine.podspec"
RCT-Folly:
:podspec: "../../third-party-podspecs/RCT-Folly.podspec"
RCTRequired:
Expand All @@ -841,6 +864,8 @@ EXTERNAL SOURCES:
:path: "../../ReactCommon"
React-graphics:
:path: "../../ReactCommon/react/renderer/graphics"
React-hermes:
:path: "../../ReactCommon/hermes"
React-jsi:
:path: "../../ReactCommon/jsi"
React-jsiexecutor:
Expand Down Expand Up @@ -890,8 +915,8 @@ SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: 19e408e76fa9258dd32191a50d60c41444f52d29
FBReactNativeSpec: a9bf67b4be55c0819bc88e1721820286c1340710
FBLazyVector: 1adcfd23a97b2a1a2339deadaaff3fd28b713e7c
FBReactNativeSpec: 3b0685bcc768f78906652dac477fd881fcdd1692
Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
Expand All @@ -903,43 +928,45 @@ SPEC CHECKSUMS:
FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
hermes-engine: 78d076d1fc7b4ecb5cc111266e6116c5a71a643e
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
RCTRequired: 1c8808cf84569265784a6c33984bbb506ada8c6e
RCTTypeSafety: b6dcb5036a808864ee8cad66ca15f263c24661cc
React: 8d809d414723bb5763093ddec7658066a21ccabc
React-bridging: cc10a051eff1f03306a1d7659593d8aac3242bc3
React-callinvoker: 5f16202ad4e45f0607b1fae0f6955a8f7c87eef1
RCTRequired: f78df0026cf2c2234e85e81cd4d1cc7c8095df83
RCTTypeSafety: 303bbc2194620ec5c99ce996043d6d40f864570f
React: 51e3282c63c180115f96cee7231f8726c7fad561
React-bridging: 474e0aa6bd33d2ea0b7f06f0f381f9956b8a2882
React-callinvoker: 73e4398b6a48222527ccff96f593be8b9210acc8
React-Codegen: 5adf19af97eb37a7d441c040521191e446255086
React-Core: 0cfb25c65d4dcb856b1807fe44a1ebe5e7ec9749
React-CoreModules: 675170bccf156da3a3348e04e2036ce401b2010d
React-cxxreact: 7276467c246302fedf598cc40d7003896ddb20ba
React-Fabric: abfd61dc5498ce165634af85d65fcc42b82b5bf4
React-graphics: 5ccc9cc0d91794fd42bc1c693e9aea207554bbef
React-jsi: a042596cb558abea721ab5e23cb175647610a73d
React-jsiexecutor: f7fbac5dff7e7ff110a66edf2626b4f4f4600ef5
React-jsinspector: 7733dd522d044aef87caa39f3eda77593358a7eb
React-logger: c7960346b021767ed90971aff592a44e3d69f8bb
React-perflogger: c4fdd48988c2d3047186fc1bc1772d634cfca2ea
React-RCTActionSheet: 166fd1df85ac10219466b45d12a5884d3eaceac1
React-RCTAnimation: d6127046c6bb44bd3e67b7503c4ad7f91131b58e
React-RCTBlob: 68675c89ebe6edf310dddd0774ba07b685f090a9
React-RCTFabric: a98a6effece6719669b8c6b4d2c33fb0edddc613
React-RCTImage: 6de9f0f4402af859849e97cc73a56a52f400f4c9
React-RCTLinking: 21bb4675c3ec8fe704672ea511e817aeb3bf8370
React-RCTNetwork: a865deadacbf6b3d863f0496e7d2c2e81c269317
React-RCTPushNotification: 7f678a88147254ede5d21a1e1e71e8a964dd0051
React-RCTSettings: 23ce1aa52ddf5db44c973bb5cc93713e871e09b6
React-RCTTest: 06c388632dc7b30df17af01c8f9e89e641b4d31c
React-RCTText: a861fbf2835299d3cc4189697cddd8bd8602afb9
React-RCTVibration: 0386f50996a153b3f39cecbe7d139763ac9a9fdf
React-rncore: 2a6ad37560e94cf7ff32e3f2ae1e708491b4c1f3
React-runtimeexecutor: 97dca9247f4d3cfe0733384b189c6930fbd402b7
ReactCommon: 6cef8ed13ee2a9d7d4cf9660dbe6dd2ea6ba7104
React-Core: aea8ce8de0e554db7ea7d1b4385f866e3ddbc441
React-CoreModules: 52f769d3d8d336e91eb749acc12f7988b7b654ab
React-cxxreact: d80e5500b78084c2c1e3721135b74a7bfc605c5c
React-Fabric: f836ca802e1accaa60fa7ab6c0e94118161007b6
React-graphics: adf208624f602277193acaa9e4a7fe7dd51e8e01
React-hermes: 6d397253ccbff988a2c6023646abcf87760b7db4
React-jsi: a4efacda8794b316aa82a46f8680b59d93af2efa
React-jsiexecutor: 6314efc38192814ecd5d925526a1e73ce1c313b5
React-jsinspector: 1f0789f435d513b12e5b56d2d041446866be6916
React-logger: f9c76e1468d4688d5919eb89883b74f88de65e28
React-perflogger: 2e1ce40b7fe35ff459aa8f0cc27fe0a7d89f9c07
React-RCTActionSheet: 1189a2b432023ef7cd0adec7cebb9564ade0b652
React-RCTAnimation: 766fe282bd9dab5ae14618407c9bf29061e1683e
React-RCTBlob: 62d686899e030a58cf36e42105c0995cb3a7d329
React-RCTFabric: 6e23028470c889a25f19dcb33c4f102ca2acd989
React-RCTImage: 342bec886719a364cbe515d4fd93e72e192763ba
React-RCTLinking: c722b63933377f3a3cf2d6f0e922b8e5af909f4d
React-RCTNetwork: 45b3083510248ea4ae3203863ee8243aa1abd1bf
React-RCTPushNotification: f6dd48274820898562412c3cd315d5f2af9400c1
React-RCTSettings: 492a5dc4841a271270f4db31c80474084bf612ed
React-RCTTest: 0ee8a4d733b9571411a3e0624a6a1b9a61054e05
React-RCTText: 3f358270fbe7d31a7ee208c3e928c131a9610ae8
React-RCTVibration: d1deed63f98e068af90e0f2150ea9e45993bfa43
React-rncore: 1513ee7427891d41c753d7a819b77041f4c4fa7c
React-runtimeexecutor: 1cecb57a0eb654f1001e612bd60dfbdf0f059243
ReactCommon: 1293daccbfb80359519d0f8e839a26a93169d2e3
ScreenshotManager: 71d047abd38a77310985b87f8136b620c5c61e88
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
Yoga: 1b1a12ff3d86a10565ea7cbe057d42f5e5fb2a07
Yoga: 76719449b33fb55dcab51c67c0afe8361d47ff0f
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 54d9bd86f3c8151531bd4da1d3ba2e2e1f9a6ca9
Expand Down
40 changes: 38 additions & 2 deletions packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@
E7DB209C22B2BA84005AC45F /* Frameworks */,
E7DB209D22B2BA84005AC45F /* Resources */,
9A596313B3964A4DEB794409 /* [CP] Copy Pods Resources */,
76789BF92416C0602AAA8F01 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -451,6 +452,7 @@
E7DB215022B2F332005AC45F /* Frameworks */,
E7DB215122B2F332005AC45F /* Resources */,
98E057AC8860597818FB485A /* [CP] Copy Pods Resources */,
47A29A79D241D54A9E90F6A9 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -568,6 +570,23 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
47A29A79D241D54A9E90F6A9 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
4930FC87997EBCAD361CEF12 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -643,6 +662,23 @@
shellPath = /bin/sh;
shellScript = "set -e\n\nexport PROJECT_ROOT=\"$SRCROOT/../../\"\nexport ENTRY_FILE=\"$SRCROOT/js/RNTesterApp.ios.js\"\nexport SOURCEMAP_FILE=../sourcemap.ios.map\n# export FORCE_BUNDLING=true \n\nWITH_ENVIRONMENT=\"../../scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../../scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
76789BF92416C0602AAA8F01 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
98E057AC8860597818FB485A /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -875,7 +911,7 @@
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -960,7 +996,7 @@
ENABLE_BITCODE = NO;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
Expand Down

0 comments on commit 673f217

Please sign in to comment.