Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,060 --> 00:00:03,420
In this lecture, we are going to prepare our editors.
2
00:00:03,460 --> 00:00:05,140
We'll be writing a lot of code.
3
00:00:05,160 --> 00:00:08,189
We're bound to make mistakes with formatting our code.
4
00:00:08,220 --> 00:00:11,770
The project was installed with iOS lint and prettier.
5
00:00:11,790 --> 00:00:16,560
However, we must run our code through these tools with the command line.
6
00:00:16,590 --> 00:00:18,180
It's not an ideal setup.
7
00:00:18,210 --> 00:00:22,710
Ideally, these tools should format our code as we write it.
8
00:00:22,740 --> 00:00:27,630
Luckily, this behavior can be achieved with a few tweaks to our editors.
9
00:00:27,660 --> 00:00:32,340
If you're using Visual Studio code, you'll be able to follow along with me.
10
00:00:32,369 --> 00:00:38,400
Otherwise, you may need to look up how to achieve this behavior with the editor of your choice.
11
00:00:38,640 --> 00:00:44,770
The first step is to install the extensions for these tools under the extension tab.
12
00:00:44,790 --> 00:00:49,840
You can install the S lint extension from a user called Microsoft.
13
00:00:49,860 --> 00:00:53,970
As for a prettier, the name of the user is called prettier.
14
00:00:56,150 --> 00:01:00,440
Both extensions should be installed and enabled for our project.
15
00:01:00,470 --> 00:01:06,210
After installing these extensions, let's update our editors settings on the menu.
16
00:01:06,230 --> 00:01:09,830
Navigate to file preferences settings.
17
00:01:11,890 --> 00:01:16,420
In the search bar search for a setting called format on save.
18
00:01:18,540 --> 00:01:21,150
The first setting should be a checkbox.
19
00:01:21,230 --> 00:01:24,340
Enable this feature by enabling this feature.
20
00:01:24,360 --> 00:01:31,590
Visual Studio code will format your files after saving them next search for a setting called default
21
00:01:31,590 --> 00:01:32,550
formatter.
22
00:01:34,740 --> 00:01:39,180
Visual Studio Code has a custom formatter for JavaScript files.
23
00:01:39,180 --> 00:01:42,610
However, we're not interested in its formatting tool.
24
00:01:42,630 --> 00:01:46,110
Prettier will fulfill all our formatting needs.
25
00:01:46,110 --> 00:01:49,400
We can change the formatter by modifying the setting.
26
00:01:49,410 --> 00:01:52,320
Change the default formatter to prettier.
27
00:01:54,520 --> 00:02:00,230
This option will only be available for editors with the prettier extension installed.
28
00:02:00,250 --> 00:02:06,550
We've successfully configured prettier but not is lint lensing can be automated too.
29
00:02:06,580 --> 00:02:12,710
Unfortunately, it's not easy to enable s lint through the UI at the top right corner.
30
00:02:12,730 --> 00:02:15,700
There's an option for viewing the settings with JSON.
31
00:02:15,700 --> 00:02:16,720
Click on it.
32
00:02:18,930 --> 00:02:22,630
The settings dot json file will open in our editor.
33
00:02:22,650 --> 00:02:26,600
Behind the scenes, the UI modifies this file for us.
34
00:02:26,610 --> 00:02:32,040
If we look at the bottom of the file, the formatting options have been added to the object.
35
00:02:32,070 --> 00:02:37,740
If we were to remove these properties, the UI would be reflected with those changes.
36
00:02:37,740 --> 00:02:44,010
In my opinion, modifying settings through the UI is simpler than modifying the JSON file.
37
00:02:44,010 --> 00:02:46,860
It reduces the likelihood of a typo.
38
00:02:47,040 --> 00:02:51,030
Automating is lint is not configurable through the UI.
39
00:02:51,060 --> 00:02:57,240
We must directly edit this file to enable us lint on saves in my file.
40
00:02:57,240 --> 00:02:59,580
I've already added a few settings.
41
00:02:59,610 --> 00:03:02,070
You do not need to copy these settings.
42
00:03:02,070 --> 00:03:05,880
Most of these are a personal preference for my projects.
43
00:03:05,880 --> 00:03:12,180
At the bottom of the file add an object called Editor Code Actions on save.
44
00:03:14,380 --> 00:03:20,170
This object can contain a list of actions that can be performed after a user saves a file.
45
00:03:20,200 --> 00:03:26,440
We can instruct Visual Studio code to perform actions from formatting to building projects.
46
00:03:26,440 --> 00:03:32,830
For our purposes, let's run is lent at a property called Source dot fix.
47
00:03:32,830 --> 00:03:36,760
All dot is linked with a value of true.
48
00:03:39,070 --> 00:03:45,550
The action we've added will force EOS Lynch to fix issues with our code as long as the extension is
49
00:03:45,550 --> 00:03:48,600
installed in our editor, this action should work.
50
00:03:48,610 --> 00:03:52,290
Let's try testing our code in our project.
51
00:03:52,300 --> 00:03:55,240
Open the app dot view component.
52
00:03:57,480 --> 00:04:01,800
I'm going to add spacing inside the header tag from the template.
53
00:04:01,800 --> 00:04:05,840
As I do so, a yellow line will appear below the spacing.
54
00:04:05,850 --> 00:04:08,640
This error is emitted from s lens.
55
00:04:08,670 --> 00:04:11,550
It does not like the formatting of our tags.
56
00:04:11,580 --> 00:04:15,540
If I were to save the file, the spacing issues would go away.
57
00:04:15,570 --> 00:04:16,829
Isn't that great?
58
00:04:16,860 --> 00:04:19,260
We don't have to run commands anymore.
59
00:04:19,290 --> 00:04:23,560
S lint and prettier are cooperating to format our code.
60
00:04:23,580 --> 00:04:26,340
This feature keeps our code consistent.
61
00:04:26,370 --> 00:04:30,300
In the next lecture, let's begin working on the music project.
5897
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.