You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/5/en/part5b.md
+55-75Lines changed: 55 additions & 75 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -636,68 +636,71 @@ Show the button for deleting a blog post only if the blog post was added by the
636
636
637
637
In part 3 we configured the [ESlint](/en/part3/validation_and_es_lint#lint) code style tool to the backend. Let's take ESlint to use in the frontend as well.
638
638
639
-
Vite has installed ESlint to the project by default, so all that's left for us to do is define our desired configuration in the <i>.eslintrc.cjs</i> file.
639
+
Vite has installed ESlint to the project by default, so all that's left for us to do is define our desired configuration in the <i>eslint.config.js</i> file.
640
640
641
-
Let's create a <i>.eslintrc.cjs</i> file with the following contents:
641
+
Let's create a <i>eslint.config.js</i> file with the following contents:
NOTE: If you are using Visual Studio Code together with ESLint plugin, you might need to add a workspace setting for it to work. If you are seeing ```Failed to load plugin react: Cannot find module 'eslint-plugin-react'``` additional configuration is needed. Adding the line ```"eslint.workingDirectories": [{ "mode": "auto" }]``` to settings.json in the workspace seems to work. See [here](https://github.com/microsoft/vscode-eslint/issues/880#issuecomment-578052807) for more information.
690
+
NOTE: If you are using Visual Studio Code together with ESLint plugin, you might need to add a workspace setting for it to work. If you are seeing <i>Failed to load plugin react: Cannot find module 'eslint-plugin-react'</i> additional configuration is needed. Adding the following line to settings.json may help:
691
+
692
+
```js
693
+
"eslint.workingDirectories": [{ "mode":"auto" }]
694
+
```
695
+
696
+
See [here](https://github.com/microsoft/vscode-eslint/issues/880#issuecomment-578052807) for more information.
694
697
695
698
Let's create [.eslintignore](https://eslint.org/docs/latest/use/configure/ignore#the-eslintignore-file) file with the following contents to the repository root
696
699
697
700
```bash
698
701
node_modules
699
702
dist
700
-
.eslintrc.cjs
703
+
eslint.config.js
701
704
vite.config.js
702
705
```
703
706
@@ -711,29 +714,6 @@ npm run lint
711
714
712
715
or using the editor's Eslint plugin.
713
716
714
-
Component _Togglable_ causes a nasty-looking warning <i>Component definition is missing display name</i>:
You can find the code for our current application in its entirety in the <i>part5-7</i> branch of [this GitHub repository](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-7).
738
718
739
719
</div>
@@ -746,6 +726,6 @@ You can find the code for our current application in its entirety in the <i>part
746
726
747
727
Add ESlint to the project. Define the configuration according to your liking. Fix all of the linter errors.
748
728
749
-
Vite has installed ESlint to the project by default, so all that's left for you to do is define your desired configuration in the <i>.eslintrc.cjs</i> file.
729
+
Vite has installed ESlint to the project by default, so all that's left for you to do is define your desired configuration in the <i>eslint.config.js</i> file.
Copy file name to clipboardExpand all lines: src/content/5/fi/osa5b.md
+56-75Lines changed: 56 additions & 75 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -634,68 +634,72 @@ Näytä poistonappi ainoastaan jos kyseessä on kirjautuneen käyttäjän lisä
634
634
635
635
Konfiguroimme osassa 3 koodin tyylistä huolehtivan [ESLintin](/osa3/validointi_ja_es_lint) backendiin. Otetaan nyt ESLint käyttöön myös frontendissa.
636
636
637
-
Vite on asentanut projektille ESLintin valmiiksi, joten ei tarvitse muuta kuin muokata tiedostossa <i>.eslintrc.cjs</i> oleva konfiguraatio halutun kaltaiseksi.
637
+
Vite on asentanut projektille ESLintin valmiiksi, joten ei tarvitse muuta kuin muokata tiedostossa <i>eslint.config.js</i> oleva konfiguraatio halutun kaltaiseksi.
HUOM: Jos käytät Visual Studio Codea yhdessä ESLint-laajennuksen kanssa, saatat joutua muokkaamaan VS Coden asetuksia, jotta linttaus toimii oikein. Jos näet virheen <i>Failed to load plugin react: Cannot find module 'eslint-plugin-react'</i>, tarvitaan lisäkonfiguraatiota. Seuraavan rivin lisääminen <i>settings.json</i>-tiedostoon voi auttaa:
690
+
691
+
```js
692
+
"eslint.workingDirectories": [{ "mode":"auto" }]
693
+
```
694
+
695
+
Katso lisätietoja [täältä](https://github.com/microsoft/vscode-eslint/issues/880#issuecomment-578052807).
696
+
693
697
Tehdään projektin juureen tiedosto [.eslintignore](https://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories) ja sille seuraava sisältö:
694
698
695
699
```bash
696
700
node_modules
697
701
dist
698
-
.eslintrc.cjs
702
+
eslint.config.js
699
703
vite.config.js
700
704
```
701
705
@@ -709,29 +713,6 @@ npm run lint
709
713
710
714
tai editorin Eslint-pluginia hyväksikäyttäen.
711
715
712
-
Komponentti _Togglable_ aiheuttaa ikävän näköisen varoituksen <i>Component definition is missing display name</i>:
713
-
714
-

715
-
716
-
Komponentin "nimettömyys" käy ilmi myös React Development Toolsilla:
717
-
718
-

Sovelluksen tämänhetkinen koodi on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-7), branchissa <i>part5-7</i>.
736
717
737
718
</div>
@@ -744,6 +725,6 @@ Sovelluksen tämänhetkinen koodi on kokonaisuudessaan [GitHubissa](https://gith
744
725
745
726
Ota projektiin käyttöön ESLint. Määrittele haluamasi kaltainen konfiguraatio. Korjaa kaikki lint-virheet.
746
727
747
-
Vite on asentanut projektille ESLintin valmiiksi, joten ei tarvita muuta kun sopiva konfiguraatio tiedostoon <i>.eslintrc.cjs</i>.
728
+
Vite on asentanut projektille ESLintin valmiiksi, joten ei tarvita muuta kun sopiva konfiguraatio tiedostoon <i>eslint.config.js</i>.
0 commit comments