Skip to content

Commit

Permalink
Run ESLint on CI (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 authored Apr 9, 2020
1 parent cb6bd0a commit 25056db
Show file tree
Hide file tree
Showing 11 changed files with 447 additions and 30 deletions.
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"env": {
"es6": true,
"node": true
},
"extends": ["eslint:recommended"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
}
22 changes: 22 additions & 0 deletions .github/eslint-stylish.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"problemMatcher": [
{
"owner": "eslint-stylish",
"pattern": [
{
"regexp": "^([^\\s].*)$",
"file": 1
},
{
"regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*?)\\s\\s+(.*)$",
"line": 1,
"column": 2,
"severity": 3,
"message": 4,
"code": 5,
"loop": true
}
]
}
]
}
19 changes: 15 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,27 @@ on:
- master
pull_request:
jobs:
iOS:
Lint-Test:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: minitest
- name: JavaScript
run: |
yarn
echo "::add-matcher::.github/eslint-stylish.json"
yarn lint:js
echo "::remove-matcher owner=eslint-stylish::"
- name: Ruby
run: |
bundle install
bundle exec rubocop
bundle exec ruby -Ilib:test test/test_test_app.rb
iOS:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install
run: |
yarn
Expand Down Expand Up @@ -70,7 +81,7 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set up Node
- name: Set up Node.js
uses: actions/setup-node@v1
with:
# Node has a bug where it crashes compiling a regular
Expand Down Expand Up @@ -102,7 +113,7 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set up Node
- name: Set up Node.js
uses: actions/setup-node@v1
with:
# Node has a bug where it crashes compiling a regular
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/xcuserdata/
*.tgz
.clang-format
.eslintrc.json
.gitattributes
.github/
.rubocop.yml
Expand Down
2 changes: 1 addition & 1 deletion example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ["module:metro-react-native-babel-preset"],
};
6 changes: 4 additions & 2 deletions example/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
* @format
*/

const blacklist = require('metro-config/src/defaults/blacklist');
const blacklist = require("metro-config/src/defaults/blacklist");

module.exports = {
resolver: {
blacklistRE: blacklist([/node_modules\/.*\/node_modules\/react-native\/.*/])
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
]),
},
transformer: {
getTransformOptions: async () => ({
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build:android": "mkdirp dist/res && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.jsbundle --assets-dest dist/res --reset-cache",
"build:ios": "mkdirp dist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.jsbundle --assets-dest dist --reset-cache"
"build:ios": "mkdirp dist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.jsbundle --assets-dest dist --reset-cache"
},
"peerDependencies": {
"react": "^16.8.6",
Expand Down
6 changes: 3 additions & 3 deletions example/react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
project: {
ios: {
project: 'ios/ReactTestApp-Dummy.xcodeproj'
}
}
project: "ios/ReactTestApp-Dummy.xcodeproj",
},
},
};
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"description": "react-native-test-app provides a test app for all supported platforms as a package",
"homepage": "https://github.com/microsoft/react-native-test-app",
"scripts": {
"format:c": "clang-format -i $(git ls-files '*.h' '*.m' '*.mm')"
"format:c": "clang-format -i $(git ls-files '*.h' '*.m' '*.mm')",
"format:js": "prettier --write $(git ls-files '*.js')",
"lint:js": "eslint $(git ls-files '*.js')"
},
"dependencies": {
"@babel/core": "^7.0.0",
Expand All @@ -27,7 +29,9 @@
"react-native": "0.60.6"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-plugin-prettier": "^3.1.2",
"plop": "^2.6.0",
"prettier": "2.0.2"
"prettier": "2.0.4"
}
}
10 changes: 4 additions & 6 deletions plopfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ module.exports = (plop) => {
displayName: name,
},
},
resources: [
"dist/res",
"dist/assets",
"dist/main.jsbundle"
],
resources: ["dist/assets", "dist/main.jsbundle", "dist/res"],
},
undefined,
2
Expand Down Expand Up @@ -178,7 +174,9 @@ module.exports = (plop) => {
template: [
"rootProject.name='example'",
"",
`apply from: file("${exclusive ? "" : "../"}node_modules/react-native-test-app/test-app.gradle")`,
`apply from: file("${
exclusive ? "" : "../"
}node_modules/react-native-test-app/test-app.gradle")`,
"applyTestAppSettings(settings)",
"",
].join("\n"),
Expand Down
Loading

0 comments on commit 25056db

Please sign in to comment.