kandi background
kandi background
Explore Kits
kandi background
Explore Kits
kandi background
Explore Kits
kandi background
Explore Kits
Explore all Blog open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Blog

5.4.2

v3.5.1

v3.4.1

1.5.2

v1.9.2

hexo

5.4.2

mastodon

v3.5.1

mastodon

v3.4.1

halo

1.5.2

vuepress

v1.9.2

Popular Libraries in Blog

Trending New libraries in Blog

Top Authors in Blog

1

28 Libraries

35671

2

11 Libraries

4127

3

10 Libraries

32

4

9 Libraries

146

5

8 Libraries

24711

6

8 Libraries

102

7

6 Libraries

794

8

5 Libraries

49

9

5 Libraries

18

10

5 Libraries

1786

1

28 Libraries

35671

2

11 Libraries

4127

3

10 Libraries

32

4

9 Libraries

146

5

8 Libraries

24711

6

8 Libraries

102

7

6 Libraries

794

8

5 Libraries

49

9

5 Libraries

18

10

5 Libraries

1786

Trending Kits in Blog

Trending Discussions on Blog

    Error while loading rule 'prettier/prettier': context.getPhysicalFilename is not a function
    What is jsconfig.json
    The unauthenticated git protocol on port 9418 is no longer supported
    npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher
    Efficient overflow-immune arithmetic mean in C/C++
    Error: Must use import to load ES Module: D:\node_modules\react-markdown\index.js require() of ES modules is not supported
    Android Studio [BumbleBee 2021.1.1] Emulator Timeout on Mac M1
    Log4j vulnerability - Is Log4j 1.2.17 vulnerable (was unable to find any JNDI code in source)?
    Converting Numbers from Base 10 to Base 60
    What's the mathematical reason behind Python choosing to round integer division toward negative infinity?

QUESTION

Error while loading rule 'prettier/prettier': context.getPhysicalFilename is not a function

Asked 2022-Apr-04 at 13:24

I am learning react js. I am a very beginner at this topic. But when I am doing setup to create a react environment I got an error. I have tried to solve the problem by Charles Stover blog in medium. But I got an error Command "up" not found.

Here's my index.js file:

1import React from 'react';
2import ReactDOM from 'react-dom';
3import App from './App';
4import reportWebVitals from './reportWebVitals';
5ReactDOM.render(
6   <React.StrictMode>
7      <App />
8   </React.StrictMode>,
9document.getElementById('root')
10);
11reportWebVitals();
12

My package.json file:

1import React from 'react';
2import ReactDOM from 'react-dom';
3import App from './App';
4import reportWebVitals from './reportWebVitals';
5ReactDOM.render(
6   <React.StrictMode>
7      <App />
8   </React.StrictMode>,
9document.getElementById('root')
10);
11reportWebVitals();
12{
13  "name": "myreact",
14  "version": "0.1.0",
15  "private": true,
16  "dependencies": {
17    "@testing-library/jest-dom": "^5.11.4",
18    "@testing-library/react": "^11.1.0",
19    "@testing-library/user-event": "^12.1.10",
20    "react": "^17.0.2",
21    "react-dom": "^17.0.2",
22    "react-scripts": "4.0.3",
23    "web-vitals": "^1.0.1"
24  },
25  "scripts": {
26    "start": "react-scripts start",
27    "build": "react-scripts build",
28    "test": "react-scripts test",
29    "eject": "react-scripts eject",
30    "lint": "yarn add -D prettier && yarn add -D babel-eslint && npx install-peerdeps --dev eslint-config-airbnb && yarn add -D eslint-config-prettier eslint-plugin-prettier"
31  },
32  "eslintConfig": {
33    "extends": [
34      "react-app",
35      "react-app/jest"
36    ]
37  },
38  "browserslist": {
39    "production": [
40      ">0.2%",
41      "not dead",
42      "not op_mini all"
43    ],
44    "development": [
45      "last 1 chrome version",
46      "last 1 firefox version",
47      "last 1 safari version"
48    ]
49  },
50  "devDependencies": {
51    "babel-eslint": "^10.1.0",
52    "eslint": "7.2.0",
53    "eslint-config-airbnb": "18.2.1",
54    "eslint-config-prettier": "^8.3.0",
55    "eslint-plugin-import": "2.22.1",
56    "eslint-plugin-jsx-a11y": "6.4.1",
57    "eslint-plugin-prettier": "^4.0.0",
58    "eslint-plugin-react": "7.21.5",
59    "eslint-plugin-react-hooks": "1.7.0",
60    "prettier": "^2.3.2"
61  }
62}
63

When I am running yarn start in terminal, I am getting an error.

1import React from 'react';
2import ReactDOM from 'react-dom';
3import App from './App';
4import reportWebVitals from './reportWebVitals';
5ReactDOM.render(
6   <React.StrictMode>
7      <App />
8   </React.StrictMode>,
9document.getElementById('root')
10);
11reportWebVitals();
12{
13  "name": "myreact",
14  "version": "0.1.0",
15  "private": true,
16  "dependencies": {
17    "@testing-library/jest-dom": "^5.11.4",
18    "@testing-library/react": "^11.1.0",
19    "@testing-library/user-event": "^12.1.10",
20    "react": "^17.0.2",
21    "react-dom": "^17.0.2",
22    "react-scripts": "4.0.3",
23    "web-vitals": "^1.0.1"
24  },
25  "scripts": {
26    "start": "react-scripts start",
27    "build": "react-scripts build",
28    "test": "react-scripts test",
29    "eject": "react-scripts eject",
30    "lint": "yarn add -D prettier && yarn add -D babel-eslint && npx install-peerdeps --dev eslint-config-airbnb && yarn add -D eslint-config-prettier eslint-plugin-prettier"
31  },
32  "eslintConfig": {
33    "extends": [
34      "react-app",
35      "react-app/jest"
36    ]
37  },
38  "browserslist": {
39    "production": [
40      ">0.2%",
41      "not dead",
42      "not op_mini all"
43    ],
44    "development": [
45      "last 1 chrome version",
46      "last 1 firefox version",
47      "last 1 safari version"
48    ]
49  },
50  "devDependencies": {
51    "babel-eslint": "^10.1.0",
52    "eslint": "7.2.0",
53    "eslint-config-airbnb": "18.2.1",
54    "eslint-config-prettier": "^8.3.0",
55    "eslint-plugin-import": "2.22.1",
56    "eslint-plugin-jsx-a11y": "6.4.1",
57    "eslint-plugin-prettier": "^4.0.0",
58    "eslint-plugin-react": "7.21.5",
59    "eslint-plugin-react-hooks": "1.7.0",
60    "prettier": "^2.3.2"
61  }
62}
63Error while loading rule 'prettier/prettier': context.getPhysicalFilename is not a function
64Occurred while linting F:\react-projects\myreact\src\index.js
65

Now what should I do?

ANSWER

Answered 2021-Sep-06 at 09:40

I got two different solution.

  1. remove

copy icondownload icon

1import React from 'react';
2import ReactDOM from 'react-dom';
3import App from './App';
4import reportWebVitals from './reportWebVitals';
5ReactDOM.render(
6   <React.StrictMode>
7      <App />
8   </React.StrictMode>,
9document.getElementById('root')
10);
11reportWebVitals();
12{
13  "name": "myreact",
14  "version": "0.1.0",
15  "private": true,
16  "dependencies": {
17    "@testing-library/jest-dom": "^5.11.4",
18    "@testing-library/react": "^11.1.0",
19    "@testing-library/user-event": "^12.1.10",
20    "react": "^17.0.2",
21    "react-dom": "^17.0.2",
22    "react-scripts": "4.0.3",
23    "web-vitals": "^1.0.1"
24  },
25  "scripts": {
26    "start": "react-scripts start",
27    "build": "react-scripts build",
28    "test": "react-scripts test",
29    "eject": "react-scripts eject",
30    "lint": "yarn add -D prettier && yarn add -D babel-eslint && npx install-peerdeps --dev eslint-config-airbnb && yarn add -D eslint-config-prettier eslint-plugin-prettier"
31  },
32  "eslintConfig": {
33    "extends": [
34      "react-app",
35      "react-app/jest"
36    ]
37  },
38  "browserslist": {
39    "production": [
40      ">0.2%",
41      "not dead",
42      "not op_mini all"
43    ],
44    "development": [
45      "last 1 chrome version",
46      "last 1 firefox version",
47      "last 1 safari version"
48    ]
49  },
50  "devDependencies": {
51    "babel-eslint": "^10.1.0",
52    "eslint": "7.2.0",
53    "eslint-config-airbnb": "18.2.1",
54    "eslint-config-prettier": "^8.3.0",
55    "eslint-plugin-import": "2.22.1",
56    "eslint-plugin-jsx-a11y": "6.4.1",
57    "eslint-plugin-prettier": "^4.0.0",
58    "eslint-plugin-react": "7.21.5",
59    "eslint-plugin-react-hooks": "1.7.0",
60    "prettier": "^2.3.2"
61  }
62}
63Error while loading rule 'prettier/prettier': context.getPhysicalFilename is not a function
64Occurred while linting F:\react-projects\myreact\src\index.js
65"prettier/prettier": [
66            "error",
67            {
68                "trailingComma": "es5",
69                "singleQuote": true,
70                "printWidth": 100,
71                "tabWidth": 4,
72                "semi": true,
73                "endOfLine": "auto"
74            }
75        ]

from .eslintrc folder and change react script version from 4.0.3 to 4.0.1 and run npm install.

  1. Use yarn upgrade -R eslint and change react script version from 4.0.3 to 4.0.1 and run npm install.

Source https://stackoverflow.com/questions/69069719

Community Discussions contain sources that include Stack Exchange Network

    Error while loading rule 'prettier/prettier': context.getPhysicalFilename is not a function
    What is jsconfig.json
    The unauthenticated git protocol on port 9418 is no longer supported
    npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher
    Efficient overflow-immune arithmetic mean in C/C++
    Error: Must use import to load ES Module: D:\node_modules\react-markdown\index.js require() of ES modules is not supported
    Android Studio [BumbleBee 2021.1.1] Emulator Timeout on Mac M1
    Log4j vulnerability - Is Log4j 1.2.17 vulnerable (was unable to find any JNDI code in source)?
    Converting Numbers from Base 10 to Base 60
    What's the mathematical reason behind Python choosing to round integer division toward negative infinity?

QUESTION

Error while loading rule 'prettier/prettier': context.getPhysicalFilename is not a function

Asked 2022-Apr-04 at 13:24

I am learning react js. I am a very beginner at this topic. But when I am doing setup to create a react environment I got an error. I have tried to solve the problem by Charles Stover blog in medium. But I got an error Command "up" not found.

Here's my index.js file:

1import React from 'react';
2import ReactDOM from 'react-dom';
3import App from './App';
4import reportWebVitals from './reportWebVitals';
5ReactDOM.render(
6   <React.StrictMode>
7      <App />
8   </React.StrictMode>,
9document.getElementById('root')
10);
11reportWebVitals();
12

My package.json file:

1import React from 'react';
2import ReactDOM from 'react-dom';
3import App from './App';
4import reportWebVitals from './reportWebVitals';
5ReactDOM.render(
6   <React.StrictMode>
7      <App />
8   </React.StrictMode>,
9document.getElementById('root')
10);
11reportWebVitals();
12{
13  "name": "myreact",
14  "version": "0.1.0",
15  "private": true,
16  "dependencies": {
17    "@testing-library/jest-dom": "^5.11.4",
18    "@testing-library/react": "^11.1.0",
19    "@testing-library/user-event": "^12.1.10",
20    "react": "^17.0.2",
21    "react-dom": "^17.0.2",
22    "react-scripts": "4.0.3",
23    "web-vitals": "^1.0.1"
24  },
25  "scripts": {
26    "start": "react-scripts start",
27    "build": "react-scripts build",
28    "test": "react-scripts test",
29    "eject": "react-scripts eject",
30    "lint": "yarn add -D prettier && yarn add -D babel-eslint && npx install-peerdeps --dev eslint-config-airbnb && yarn add -D eslint-config-prettier eslint-plugin-prettier"
31  },
32  "eslintConfig": {
33    "extends": [
34      "react-app",
35      "react-app/jest"
36    ]
37  },
38  "browserslist": {
39    "production": [
40      ">0.2%",
41      "not dead",
42      "not op_mini all"
43    ],
44    "development": [
45      "last 1 chrome version",
46      "last 1 firefox version",
47      "last 1 safari version"
48    ]
49  },
50  "devDependencies": {
51    "babel-eslint": "^10.1.0",
52    "eslint": "7.2.0",
53    "eslint-config-airbnb": "18.2.1",
54    "eslint-config-prettier": "^8.3.0",
55    "eslint-plugin-import": "2.22.1",
56    "eslint-plugin-jsx-a11y": "6.4.1",
57    "eslint-plugin-prettier": "^4.0.0",
58    "eslint-plugin-react": "7.21.5",
59    "eslint-plugin-react-hooks": "1.7.0",
60    "prettier": "^2.3.2"
61  }
62}
63

When I am running yarn start in terminal, I am getting an error.

1import React from 'react';
2import ReactDOM from 'react-dom';
3import App from './App';
4import reportWebVitals from './reportWebVitals';
5ReactDOM.render(
6   <React.StrictMode>
7      <App />
8   </React.StrictMode>,
9document.getElementById('root')
10);
11reportWebVitals();
12{
13  "name": "myreact",
14  "version": "0.1.0",
15  "private": true,
16  "dependencies": {
17    "@testing-library/jest-dom": "^5.11.4",
18    "@testing-library/react": "^11.1.0",
19    "@testing-library/user-event": "^12.1.10",
20    "react": "^17.0.2",
21    "react-dom": "^17.0.2",
22    "react-scripts": "4.0.3",
23    "web-vitals": "^1.0.1"
24  },
25  "scripts": {
26    "start": "react-scripts start",
27    "build": "react-scripts build",
28    "test": "react-scripts test",
29    "eject": "react-scripts eject",
30    "lint": "yarn add -D prettier && yarn add -D babel-eslint && npx install-peerdeps --dev eslint-config-airbnb && yarn add -D eslint-config-prettier eslint-plugin-prettier"
31  },
32  "eslintConfig": {
33    "extends": [
34      "react-app",
35      "react-app/jest"
36    ]
37  },
38  "browserslist": {
39    "production": [
40      ">0.2%",
41      "not dead",
42      "not op_mini all"
43    ],
44    "development": [
45      "last 1 chrome version",
46      "last 1 firefox version",
47      "last 1 safari version"
48    ]
49  },
50  "devDependencies": {
51    "babel-eslint": "^10.1.0",
52    "eslint": "7.2.0",
53    "eslint-config-airbnb": "18.2.1",
54    "eslint-config-prettier": "^8.3.0",
55    "eslint-plugin-import": "2.22.1",
56    "eslint-plugin-jsx-a11y": "6.4.1",
57    "eslint-plugin-prettier": "^4.0.0",
58    "eslint-plugin-react": "7.21.5",
59    "eslint-plugin-react-hooks": "1.7.0",
60    "prettier": "^2.3.2"
61  }
62}
63Error while loading rule 'prettier/prettier': context.getPhysicalFilename is not a function
64Occurred while linting F:\react-projects\myreact\src\index.js
65

Now what should I do?

ANSWER

Answered 2021-Sep-06 at 09:40

I got two different solution.

  1. remove

copy icondownload icon

1import React from 'react';
2import ReactDOM from 'react-dom';
3import App from './App';
4import reportWebVitals from './reportWebVitals';
5ReactDOM.render(
6   <React.StrictMode>
7      <App />
8   </React.StrictMode>,
9document.getElementById('root')
10);
11reportWebVitals();
12{
13  "name": "myreact",
14  "version": "0.1.0",
15  "private": true,
16  "dependencies": {
17    "@testing-library/jest-dom": "^5.11.4",
18    "@testing-library/react": "^11.1.0",
19    "@testing-library/user-event": "^12.1.10",
20    "react": "^17.0.2",
21    "react-dom": "^17.0.2",
22    "react-scripts": "4.0.3",
23    "web-vitals": "^1.0.1"
24  },
25  "scripts": {
26    "start": "react-scripts start",
27    "build": "react-scripts build",
28    "test": "react-scripts test",
29    "eject": "react-scripts eject",
30    "lint": "yarn add -D prettier && yarn add -D babel-eslint && npx install-peerdeps --dev eslint-config-airbnb && yarn add -D eslint-config-prettier eslint-plugin-prettier"
31  },
32  "eslintConfig": {
33    "extends": [
34      "react-app",
35      "react-app/jest"
36    ]
37  },
38  "browserslist": {
39    "production": [
40      ">0.2%",
41      "not dead",
42      "not op_mini all"
43    ],
44    "development": [
45      "last 1 chrome version",
46      "last 1 firefox version",
47      "last 1 safari version"
48    ]
49  },
50  "devDependencies": {
51    "babel-eslint": "^10.1.0",
52    "eslint": "7.2.0",
53    "eslint-config-airbnb": "18.2.1",
54    "eslint-config-prettier": "^8.3.0",
55    "eslint-plugin-import": "2.22.1",
56    "eslint-plugin-jsx-a11y": "6.4.1",
57    "eslint-plugin-prettier": "^4.0.0",
58    "eslint-plugin-react": "7.21.5",
59    "eslint-plugin-react-hooks": "1.7.0",
60    "prettier": "^2.3.2"
61  }
62}
63Error while loading rule 'prettier/prettier': context.getPhysicalFilename is not a function
64Occurred while linting F:\react-projects\myreact\src\index.js
65"prettier/prettier": [
66            "error",
67            {
68                "trailingComma": "es5",
69                "singleQuote": true,
70                "printWidth": 100,
71                "tabWidth": 4,
72                "semi": true,
73                "endOfLine": "auto"
74            }
75        ]

from .eslintrc folder and change react script version from 4.0.3 to 4.0.1 and run npm install.

  1. Use yarn upgrade -R eslint and change react script version from 4.0.3 to 4.0.1 and run npm install.

Source https://stackoverflow.com/questions/69069719