GithubHelp home page GithubHelp logo

expo / eslint-config-universe Goto Github PK

View Code? Open in Web Editor NEW
111.0 4.0 7.0 122 KB

Moved to https://github.com/expo/expo/tree/master/packages/eslint-config-universe

License: MIT License

JavaScript 100.00%
expo eslintrc react-native

eslint-config-universe's Introduction

eslint-config-universe's People

Contributors

brentvatne avatar expbot avatar fson avatar ide avatar markogresak avatar nicknovitski avatar thymikee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eslint-config-universe's Issues

Cannot configure double quotes

According to Configuring ESLint I can do:

{
    "rules": {
        "eqeqeq": "off",
        "curly": "error",
        "quotes": ["error", "double"]
    }
}

However, with the following configuration in my package.json file, the rule is ignored:

  "eslintConfig": {
    "extends": "universe/native",
    "rules": {
      "quotes": ["error", "double"]
    },
    "settings": {
      "react": {
        "version": "detect"
      }
    }
  },
  "prettier": {
    "trailingComma": "all"
  }

When I change it to "quotes": "double", VS Code does not give me any warnings about double quotes however eslint complains that:

Configuration for rule "quotes" is invalid: 	Severity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '"double"'). 

And I don't get any errors when using single quotes.

Add error only configs

First of all, thank you for this project. The config is top notch and we can finally remove the eslint clutter we had.

My only issue is that when working with rookies, I would like to be able to enforce every rule as errors instead of warnings. Is there an easy way to do so without rewriting every rule?

'define' is not defined no-undef

after the following Installation steps, my current code looks
package.json

  {
    "main": "node_modules/expo/AppEntry.js",
    "scripts": {
      "start": "expo start",
      "android": "expo start --android",
      "ios": "expo start --ios",
      "web": "expo start --web",
      "eject": "expo eject"
    },
    "dependencies": {
      "expo": "^33.0.0",
      "react": "16.8.3",
      "react-dom": "^16.8.6",
      "react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
      "react-native-web": "^0.11.4"
    },
    "devDependencies": {
      "babel-preset-expo": "^5.1.1",
      "eslint": "^6.1.0",
      "eslint-config-universe": "^1.0.7",
      "prettier": "^1.18.2"
    },
    "private": true,
    "eslintConfig": {
      "extends": ["universe","universe/node", "universe/web","universe/native"]
    }
  }


.eslintrc.js

module.exports = {
    extends: ["universe","universe/node", "universe/web","universe/native"],
};

so I'm getting error

Failed to compile.
/usr/local/lib/node_modules/expo-cli/node_modules/react-error-overlay/lib/index.js
Line 1: 'define' is not defined no-undef
Line 1: 'define' is not defined no-undef
Line 1: 'regeneratorRuntime' is not defined no-undef
Line 1: 'h' is a function no-func-assign
Line 1: 'm' is a function no-func-assign
Line 1: 'R' is a function no-func-assign
Line 1: 'q' is a function no-func-assign
Line 1: 'W' is a function no-func-assign

Search for the keywords to learn more about each error.

Typescript required

Plugin requires that typescript is installed even if you arent using typescript, is there a way to decouple this?

"extends": "expo/react" is not working

"extends": "expo/react" throws config error
while "extends": "expo" is working perfectly with exception of being unusable with React's JSX (which defies the purpose of a whole config?)
I'm using Atom editor (by the way, it threw an "eslint-plugin-flowtype" error, so I installed it (you probably should mention it in the readme)

Add no-unresolved as default?

I hadd to add "import/no-unresolved": 2 to my config rules to make sure I get an error when I'm importing something that can't be resolved path wise.

Do you guys think this would be a useful rule to have as default in this config?

Option to make prop type validation required?

Recently switched project from airbnb config to universe due to cleaner implementation and universal approach for cross platform apps.

One feature I am missing right now is errors for props being used without correlating prop type validation, is there an option to enable this without extending into another eslint packages?

no-unused-vars

EsLint is giving me no-unused-vars for things that I am using in the JSX

Eslint assumed latest React version but I use universe/node config

I have initialized a node project. I saw eslint-config-universe and thought of using it for my node lint config.

I have installed the required dependencies:

"devDependencies": {
    "eslint-config-universe": "^2.0.0",
    "@typescript-eslint/eslint-plugin": "^2.3.1",
    "@typescript-eslint/parser": "^2.3.1",
    "eslint": "^6.4.0",
    "prettier": "^1.18.2",
    "typescript": "^3.6.3"
  }

and I made the following .eslintrc.js file:

module.exports = {
  extends: "universe/node"
};

The following from ESLint message got me confused. Why is it trying to detect react version when I specified universe/node?

image

Possibly remove './shared/react.js' from

extends: ['./shared/core.js', './shared/react.js', './shared/prettier.js'],

ESLint fails with non-JSON config

Example .prettierrc

printWidth: 100
tabWidth: 2
singleQuote: true
jsxBracketSameLine: true
trailingComma: 'es5'

It's in YAML format, which is correct according to the documentation.
But if I use it, I get this error:

SyntaxError: Cannot read config file: [redacted]/node_modules/eslint-config-universe/shared/prettier.js
Error: Unexpected token a in JSON at position 1
Referenced from: [redacted]/node_modules/eslint-config-universe/default.js
Referenced from: [redacted]t/.eslintrc.js
    at JSON.parse (<anonymous>)
    at readPrettierConfig ([redacted]/node_modules/eslint-config-universe/shared/readPrettierConfig.js:21:19)
    at Object.<anonymous> ([redacted]/node_modules/eslint-config-universe/shared/prettier.js:15:35)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)

Cannot read property 'type' of undefined

Hello !

I have a problem when I'm trying to write es7 decorators.
I have this error with this command ./node_modules/.bin/eslint pages/login.js :

Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined
    at isForInRef (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/rules/no-unused-vars.js:410:24)
    at variable.references.some.ref (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/rules/no-unused-vars.js:447:21)
    at Array.some (<anonymous>)
    at isUsedVariable (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/rules/no-unused-vars.js:446:40)
    at collectUnusedVariables (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/rules/no-unused-vars.js:569:26)
    at collectUnusedVariables (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/rules/no-unused-vars.js:576:17)
    at Program:exit (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/rules/no-unused-vars.js:621:36)
    at listeners.(anonymous function).forEach.listener (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.leaveNode (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/util/node-event-generator.js:303:14)
    at CodePathAnalyzer.leaveNode (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:630:23)
    at Traverser.leave [as _leave] (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/linter.js:1000:32)
    at Traverser._traverse (/Users/guillaumemartinez/GitHub/sodexo-web/node_modules/eslint/lib/util/traverser.js:155:18)

Content of pages/login.js :

@App
export default class Login extends React.PureComponent {
  render() {
    return <div />
  }
}

Updating babel-eslint to ^8.1.2 solve the problem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.