Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting is not defined by "exports" #270

Closed
billnbell opened this issue Jul 18, 2022 · 8 comments
Closed

Getting is not defined by "exports" #270

billnbell opened this issue Jul 18, 2022 · 8 comments

Comments

@billnbell
Copy link

5.0.0 - getting
is not defined by "exports"

warn Package eslint-plugin-eslint-plugin has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/bill/theclub/TheClub/node_modules/eslint-plugin-eslint-plugin/package.json

How to fix?

@aladdin-add
Copy link
Contributor

looks like its package.json was read somewhere, while it's not exported. related: #259

can you share the detailed error log?

@billnbell
Copy link
Author

Maybe we can try something like:

  "exports": {
       "./package.json": "./package.json",
       ".": "./lib/index.js"
  },

@billnbell
Copy link
Author

this is all I am getting:

yarn ios
yarn run v1.22.18
$ unset PREFIX && npx react-native run-ios
warn Package eslint-plugin-eslint-plugin has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/bill/theclub/TheClub/node_modules/eslint-plugin-eslint-plugin/package.json
info Found Xcode workspace "TheClub.xcworkspace"
info Launching iPhone 13 (iOS 15.5)
info Building (using "xcodebuild -workspace TheClub.xcworkspace -configuration Debug -scheme TheClub -destination id=A84B8F25-82C8-4852-8B09-CC611DC6415A")
success Successfully built the app

@billnbell
Copy link
Author

The fix you put in works for me.

@bmish
Copy link
Member

bmish commented Jul 18, 2022

Just wondering what do you need to import package.Jason for?

@billnbell
Copy link
Author

No idea. Maybe related to me .eslintrc.json ?

{
  "parser": "@typescript-eslint/parser",
  "extends": [
    "airbnb",
    "plugin:import/typescript",
    "plugin:react/recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:react-hooks/recommended",
    "plugin:prettier/recommended"
  ],
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "plugins": [
    "jest",
    "react",
    "react-hooks",
    "react-native",
    "simple-import-sort",
    "@typescript-eslint",
    "import",
    "prettier"
  ],
  "env": {
    "es2021": true,
    "react-native/react-native": true,
    "jest/globals": true,
    "jest": true
  },
  "settings": {
    "react": {
      "version": "detect"
    },
    "import/resolver": {
      "typescript": {}
    }
  },
  "rules": {
    "no-restricted-syntax": [
      "error",
      {
        "selector": "ForInStatement",
        "message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
      },
      {
        "selector": "LabeledStatement",
        "message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
      },
      {
        "selector": "WithStatement",
        "message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
      }
    ],
    "react/function-component-definition": [2, { "namedComponents": "arrow-function", "unnamedComponents": "arrow-function" }],
    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx"] }],
    "react-native/no-unused-styles": 0,
    "react-native/no-color-literals": 1,
    "react-native/no-inline-styles": 0,
    "react-native/no-single-element-style-arrays": 2,
    "react-native/no-raw-text": 0,
    "react-hooks/exhaustive-deps": "warn",
    "prettier/prettier": "error",
    "arrow-body-style": "off",
    "react/jsx-wrap-multilines": ["error", {"declaration": false, "assignment": false}],
    "prefer-arrow-callback": "off",
    "simple-import-sort/imports": "error",
    "simple-import-sort/exports": "error",
    "@typescript-eslint/ban-ts-comment": "off",
    "@typescript-eslint/ban-ts-ignore": "off",
    "no-restricted-globals": "warn",
    "no-shadow": "error",
    "@typescript-eslint/no-use-before-define": "error",
    "@typescript-eslint/no-empty-function": ["warn", { "allow": ["arrowFunctions"] }],
    "camelcase": "warn",
    "react/display-name": "off",
    "react/prop-types": "warn",
    "max-len": ["warn", { "code": 120 }],
    "no-use-before-define": "off",
    "function-paren-newline": "off",
    "curly": ["error", "all"],
    "no-void": "off",
    "object-curly-newline": "off",
    "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
    "operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" } }],
    "semi": "off",
    "@typescript-eslint/semi": "error",
    "react/no-array-index-key": "warn",
    "react/require-default-props": "warn",
    "react/destructuring-assignment": "warn",
    "react/jsx-props-no-spreading": "off",
    "react/no-unstable-nested-components": "warn",
    "react/jsx-no-useless-fragment": "warn",
    "react/no-unused-prop-types": "warn",
    "react/jsx-no-constructed-context-values": "warn",
    "no-nested-ternary": "warn",
    "arrow-parens": [
            2,
            "always",
            { "requireForBlockBody": true }
        ],
    "implicit-arrow-linebreak": 0,
    "no-console": 0,
    "import/extensions": [
      "error",
      "ignorePackages",
      {
        "js": "never",
        "mjs": "never",
        "jsx": "never",
        "ts": "never",
        "tsx": "never"
      }
    ]
  }
}

@aladdin-add
Copy link
Contributor

aladdin-add commented Jul 18, 2022

maybe another plugin? it seems no harm to export it, what do you think just merge #271, and release it as a patch?

@bmish
Copy link
Member

bmish commented Jul 18, 2022

The fix seems fine given that ESLint does the same thing but it would still be nice to know why it's needed in this case (it wasn't needed for me). Maybe some other dependency or part of the environment is outdated.

https://github.com/eslint/eslint/blob/0bcd2255c40b5c115a95181864776b0dd456c2dc/package.json#L11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants