Skip to content

Commit

Permalink
migrate to the eslint config supplied by react-native-init
Browse files Browse the repository at this point in the history
  • Loading branch information
ruddell committed Sep 10, 2019
1 parent ec3dd00 commit c7e693d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 46 deletions.
31 changes: 31 additions & 0 deletions boilerplate/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
root: true,
extends: '@react-native-community',
rules: {
semi: [2, 'never'],
quotes: [2, 'single', { avoidEscape: true }],
//todo remove the next two rules
'react-native/no-inline-styles': 0,
'react/no-string-refs': 0,
},
globals: {
describe: 'readonly',
test: 'readonly',
jest: 'readonly',
expect: 'readonly',
fetch: 'readonly',
navigator: 'readonly',
__DEV__: 'readonly',
XMLHttpRequest: 'readonly',
FormData: 'readonly',
React$Element: 'readonly',
before: 'readonly',
beforeEach: 'readonly',
by: 'readonly',
element: 'readonly',
it: 'readonly',
device: 'readonly',
after: 'readonly',
afterEach: 'readonly',
},
}
10 changes: 10 additions & 0 deletions boilerplate/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
semi: false,
printWidth: 100,
tabWidth: 2,
bracketSpacing: true,
useTabs: false
};
2 changes: 1 addition & 1 deletion boilerplate/app/modules/entities/entities-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { ScrollView, Text } from 'react-native'
import { connect } from 'react-redux'
// Styles
/*eslint-disable */
/*eslint-disable no-unused-vars*/
import RoundedButton from '../../shared/components/rounded-button/rounded-button'
import {
// ignite-jhipster-entity-screen-import-needle
Expand Down
2 changes: 1 addition & 1 deletion boilerplate/app/navigation/layouts.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function handleOpenURL (event) {
if (importantParameters.length === 1) {
switch (importantParameters[0]) {
case 'register':
console.tron.log(`Sending to Register Page`)
console.tron.log('Sending to Register Page')
registerScreen()
break
default:
Expand Down
57 changes: 13 additions & 44 deletions boilerplate/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@
"android:devices": "$ANDROID_HOME/platform-tools/adb devices",
"android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V",
"android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82",
"precommit": "npm run git-hook",
"prepush": "npm run git-hook",
"git-hook": "npm test -s",
<%_ if (!props.skipLint) { _%>
"lint": "standard --verbose | snazzy",
"lintdiff": "git diff --name-only --cached --relative | grep '\\.js$' | xargs standard | snazzy",
"fixcode": "standard --fix",
<%_ } _%>
"lint": "eslint app test index.js --ext .js",
"prettier": "prettier --write \"app/**/*.js\" \"test/**/*.js\" index.js",
"precommit": "lint-staged",
"postinstall": "patch-package"
},
"dependencies": {
Expand Down Expand Up @@ -62,6 +57,8 @@
"enzyme-adapter-react-16": "1.14.0",
"ignite-jhipster": "<%= props.packageVersion %>",
"jest": "24.9.0",
"@react-native-community/eslint-config": "0.0.5",
"lint-staged": "9.2.3",
<%_ if (props.authType === 'oauth2') { _%>
"react-native-app-auth": "4.4.0",
<%_ } _%>
Expand All @@ -75,17 +72,19 @@
"reactotron-react-native": "3.6.5",
"reactotron-redux": "3.1.1",
"reactotron-redux-saga": "4.2.2",
<%_ if (!props.skipLint) { _%>
"babel-eslint": "10.0.2",
"snazzy": "8.0.0",
"standard": "12.0.1",
<%_ } _%>
"patch-package": "6.1.2",
"rimraf": "3.0.0"
},
"lint-staged": {
"{,app/**/,test/**/}*.{js}": [
"prettier --write",
"eslint --fix --ext .js",
"git add"
]
},
"jest": {
"testMatch": [
"**/Tests/**/*.js",
"**/test/**/*.js",
"**/?(*.)(spec|test).js?(x)"
],
"testPathIgnorePatterns":[
Expand Down Expand Up @@ -113,36 +112,6 @@
],
"preset": "react-native"
},
<%_ if (!props.skipLint) { _%>
"standard": {
"parser": "babel-eslint",
"globals": [
"describe",
"test",
"jest",
"expect",
"fetch",
"navigator",
"__DEV__",
"XMLHttpRequest",
"FormData",
"React$Element",
"element",
"by",
"beforeEach",
"device",
"it",
"before",
"after",
"afterEach",
"waitFor"
],
"ignore": [
"ignite/**",
"metro.config.js"
]
},
<%_ } _%>
<%_ if (props.detox) { _%>
"detox": {
"configurations": {
Expand Down
2 changes: 2 additions & 0 deletions src/boilerplate/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ module.exports = async function (context, props, jhipsterConfig) {
spinner.text = '▸ generating files'
const templates = [
{ template: 'index.js.ejs', target: 'index.js' },
{ template: '.eslintrc.js', target: '.eslintrc.js' },
{ template: '.prettierrc.js', target: '.prettierrc.js' },
{ template: 'README.md', target: 'README.md' },
{ template: 'ignite.json.ejs', target: 'ignite/ignite.json' },
{ template: '.editorconfig', target: '.editorconfig' },
Expand Down

0 comments on commit c7e693d

Please sign in to comment.