Skip to content

Commit

Permalink
ci: Update eslint toolchain
Browse files Browse the repository at this point in the history
Uses @react-native-community/eslint-config to mange linting.
This also allows linting the typescript definitions file.
  • Loading branch information
iRoachie committed Jul 25, 2019
1 parent 1be890e commit c6163d8
Show file tree
Hide file tree
Showing 9 changed files with 349 additions and 357 deletions.
143 changes: 3 additions & 140 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,144 +1,7 @@
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"es6": true
},
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"extends": ["prettier", "prettier/flowtype", "prettier/react"],
"plugins": [
"babel",
"flowtype",
"import",
"react",
"react-native",
"prettier"
],
"extends": "@react-native-community",
"rules": {
"constructor-super": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-delete-var": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-new-symbol": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-undef": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unused-labels": "error",
"no-unused-vars": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"babel/new-cap": "off",
"babel/object-curly-spacing": "off",
"babel/arrow-parens": "off",
"flowtype/boolean-style": ["error", "boolean"],
"flowtype/define-flow-type": "error",
"flowtype/no-dupe-keys": "error",
"flowtype/no-primitive-constructor-types": "error",
"flowtype/no-weak-types": "off",
"flowtype/require-parameter-type": "off",
"flowtype/require-return-type": "off",
"flowtype/require-valid-file-annotation": "error",
"flowtype/require-variable-type": "off",
"flowtype/sort-keys": "off",
"flowtype/type-id-match": "off",
"flowtype/use-flow-type": "error",
"flowtype/valid-syntax": "error",
"import/no-unresolved": "error",
"import/named": "error",
"import/default": "off",
"import/namespace": "off",
"import/export": "error",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/no-deprecated": "off",
"import/no-extraneous-dependencies": "off",
"import/no-commonjs": "error",
"import/no-amd": "error",
"import/no-nodejs-modules": "off",
"import/imports-first": "error",
"import/no-duplicates": "error",
"import/no-namespace": "off",
"import/extensions": [
"error",
{
"js": "never",
"json": "always"
}
],
"import/order": "off",
"react/display-name": "off",
"react/forbid-prop-types": "off",
"react/no-danger": "error",
"react/no-deprecated": "error",
"react/no-did-mount-set-state": "error",
"react/no-did-update-set-state": "off",
"react/no-direct-mutation-state": "error",
"react/no-is-mounted": "error",
"react/no-multi-comp": "off",
"react/no-set-state": "off",
"react/no-string-refs": "error",
"react/no-unknown-property": "error",
"react/prefer-es6-class": "error",
"react/prop-types": "error",
"react/react-in-jsx-scope": "error",
"react/require-render-return": "error",
"react/self-closing-comp": "error",
"react/sort-comp": "error",
"react/sort-prop-types": "off",
"react/jsx-boolean-value": ["error", "never"],
"react/jsx-handler-names": "off",
"react/jsx-key": "error",
"react/jsx-no-bind": "off",
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-literals": "off",
"react/jsx-no-undef": "error",
"react/jsx-pascal-case": "error",
"react/jsx-sort-props": "off",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react-native/no-unused-styles": "error",
"react-native/split-platform-components": "off",
"prettier/prettier": [
"error",
{
"trailingComma": "es5",
"singleQuote": true
}
]
"react-native/no-inline-styles": 0,
"react/no-did-update-set-state": 0
}
}
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "es5"
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cache:
install:
- yarn
script:
- yarn run test
- yarn run lint
deploy:
provider: npm
email: joel@oblador.se
Expand Down
6 changes: 3 additions & 3 deletions Accordion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface AccordionProps<T> {
* A function that is called when the currently active section(s) are updated.
*/
onChange(indexes: number[]): void;

/**
* Controls whether user can interact with accordion
*/
Expand Down Expand Up @@ -117,12 +117,12 @@ export interface AccordionProps<T> {
*/
touchableProps?: {};

/**
/**
* Optional styling for the section container
*/
sectionContainerStyle?: StyleProp<ViewStyle>;

/**
/**
* Optional styling for the Accordion container
*/
containerStyle?: StyleProp<ViewStyle>;
Expand Down
4 changes: 1 addition & 3 deletions Example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ export default class App extends Component {
<Text style={styles.multipleToggle__title}>Multiple Select?</Text>
<Switch
value={multipleSelect}
onValueChange={multipleSelect =>
this.setState({ multipleSelect })
}
onValueChange={a => this.setState({ multipleSelect: a })}
/>
</View>

Expand Down
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface CollapsibleProps {

/**
* Enable pointer events on collapsed view
*
*
* @default false
*/
enablePointerEvents?: boolean;
Expand All @@ -81,7 +81,7 @@ export interface CollapsibleProps {
* Optional styling for the container
*/
style?: StyleProp<ViewStyle>;

/**
* Function called when the animation finished
*/
Expand Down
25 changes: 9 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
"name": "react-native-collapsible",
"version": "1.4.0",
"description": "Animated collapsible component for React Native using the Animated API. Good for accordions, toggles etc",
"main": "Collapsible.js",
"types": "index.d.ts",
"scripts": {
"test": "eslint *.js"
},
"keywords": [
"react-native",
"react-component",
Expand All @@ -31,21 +26,19 @@
"url": "https://github.com/oblador/react-native-collapsible/issues"
},
"homepage": "https://github.com/oblador/react-native-collapsible",
"main": "Collapsible.js",
"types": "index.d.ts",
"scripts": {
"lint": "eslint --ext js,ts ."
},
"devDependencies": {
"babel-eslint": "^8.2.6",
"@react-native-community/eslint-config": "^0.0.5",
"eslint": "^5.2.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-flowtype": "^2.50.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "^7.10.0",
"eslint-plugin-react-native": "^3.2.1",
"husky": "^1.1.0",
"lint-staged": "^7.3.0",
"prettier": "^1.13.7",
"react": "16.4.1",
"react-native": "0.56.0"
"react-native": "0.56.0",
"typescript": "^3.5.3"
},
"dependencies": {
"prop-types": "^15.6.2"
Expand All @@ -60,7 +53,7 @@
}
},
"lint-staged": {
"*.js": [
"*.{js,ts}": [
"eslint --fix",
"git add"
]
Expand Down
Loading

0 comments on commit c6163d8

Please sign in to comment.