Coder Social home page Coder Social logo

Comments (5)

morewings avatar morewings commented on May 25, 2024

I did check "react/require-default-props": 0 case just now. And "it works on my machine"™. But I'm using Webstorm.
Can you share full eslint config and yarn lint:js command output?

Something similarly annoying happens when 'import/no-unresolved' prevents the app from building, because it cannot find an index.js file that is clearly where it should be.

I had similar errors many times in different projects. Seems like it's webpack bug. Do you have watchman installed?

from cra-template-quickstart-redux.

janrop avatar janrop commented on May 25, 2024

.eslintrc

{
  "extends": [
    "airbnb",
    "react-app",
    "prettier",
    "prettier/flowtype",
    "prettier/react"
  ],
  "rules": {
    // Allow jsx tags inside .js files.
    "react/jsx-filename-extension": [1, {"extensions": [".js", ".jsx"]}],
    "import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.ts", "**/*.test.tsx", "**/*.stories.js"]}],
    // Disable props spreading (<App {...props} />) warning.
    "react/jsx-props-no-spreading": 0,
    "react/forbid-prop-types": 0,
    // Throw warning instead of error when using array index as a key.
    "react/no-array-index-key": 1,
    // Allow modules with named exports only.
    "import/prefer-default-export": 0,
    // Force {foo: 'bar'} object literal syntax.
    "object-curly-spacing": ["error", "never"],
    // Throw warning instead of error. Feel free to choose your favorite option https://eslint.org/docs/rules/arrow-body-style
    "arrow-body-style": ["warn", "as-needed"],
    // Make prettier code formatting suggestions more verbose.
    "prettier/prettier": ["warn"],
    // Throw warning when <a href="#"> or <a href="javascript:void(0)"> are used. Use <button> instead.
    "jsx-a11y/anchor-is-valid": ["warn", {"aspects": ["invalidHref"]}],
    // Allow using (props) => <Component /> and ({propName}) => <Component /> syntax.
    "react/destructuring-assignment": "off",
    // Disable <Fragment> => <> replacement. Feel free to change
    "react/jsx-fragments": "off",
    // Below is the set of functional rules to warn developer about accidental mutations, which may cause error in reducers etc.
    // No delete operator.
    "fp/no-delete": "warn",
    // Warning when Object.assign(a, b) used, since it mutates first argument. Object.assign({}, a, b) is ok.
    "fp/no-mutating-assign": "warn",
    // Warning when mutating method (pop, push, reverse, shift, sort, splice, unshift, etc) is used. Ramda and lodash/fp are allowed (_.pop, R.push)
    "fp/no-mutating-methods": [
      "warn",
      {
        "allowedObjects": ["_", "R"]
      }
    ],
    // Warning when mutating operators (++, --, etc) are used, object = {} also. `Component.propTypes`, `Component.defaultProps`, common.js (`module.exports`) and `ref.current` are ok.
    "fp/no-mutation": [
      "warn",
      {
        "commonjs": true,
        "allowThis": true,
        "exceptions": [{"property": "propTypes"}, {"property": "defaultProps"}, {"property": "current"}]
      }
    ],
    "import/no-unresolved": "off",
    "react/require-default-props": 0
  },
  "plugins": ["prettier", "fp"],
  "settings": {
    "import/resolver": {
      "node": {
        "moduleDirectory": ["node_modules", "./src"]
      }
    }
  },
  "overrides": [
    {
      "files": [ "./*.js"],
      "rules": {
        "global-require": 0
      }
    },
    {
      "files": ["**/*.spec.js"],
      "rules": {
        "react/prop-types": "off"
      }
    }
  ]
}

yarn lint:js

yarn run v1.22.4
$ npx eslint ./src/

/Users/janropertz/projects/mediploy/backend-ui/src/screens/DrillScreen/DrillScreen.js
   2:16  warning  'useState' is defined but never used                  no-unused-vars
  12:9   warning  'drillCategories' is assigned a value but never used  no-unused-vars
  29:3   warning  Unexpected console statement                          no-console

✖ 3 problems (0 errors, 3 warnings)

✨  Done in 2.94s.

yarn start

Failed to compile.

./src/screens/DrillScreen/DrillForm.js
  Line 29:3:  propType "onChange" is not required, but has no corresponding defaultProps declaration  react/require-default-props

Search for the keywords to learn more about each error.

Do you have watchman installed?

I guess not. Should I try that?

from cra-template-quickstart-redux.

morewings avatar morewings commented on May 25, 2024

I guess not. Should I try that?

Yes. It may help.

from cra-template-quickstart-redux.

janrop avatar janrop commented on May 25, 2024

Ok. I don't know if it was installing watchman or deleting node_modules and yarn, yarn starting again. But now it renders again 🤷‍♂️

Thanks für the suggestions.

from cra-template-quickstart-redux.

morewings avatar morewings commented on May 25, 2024

You are welcome.

from cra-template-quickstart-redux.

Related Issues (20)

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.