Eslint.org/docs/develo… Selint shareable configuration introduction;

I was stunned when I received this little requirement. I’m a front-end CV warrior and never cared about project builds (typescript format, ESLint configuration, etc.) until I found esLint plugins online and created development templates based on them. I am resistant to the so-called English documents on the official website. It’s an Epiphany in hindsight.

Nonsense not to say, the topic; Create an NPM package

NPM init if you press enter at the end of the line produces a package.json file with the name of the base file and the version number and so on and the entry is index.js

{" name ":" demo ", "version" : "1.0.0", "description" : ""," main ":" index. Js ", "scripts" : {" test ", "echo \" Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" }Copy the code

According to the process of the official website, I created a new index.js in the directory. The demo on the official website has globals variables like this. Rules is a summary of the project rules, that is, directly copy the configuration of the esLint project we have all pasted over. I thought that was it

It’s starting to hit a dead end with no experience. Git publish package NPM publish package NPM publish package NPM publish package First of all, NPM adduser followed this command to operate the NPM library. After registering NPM, some operations such as username password email were published to our company’s private Git repository. I told my supervisor in a sweat that I shipped the esLint package to our private Git. A meal of operation… However, I still didn’t notice the use of NPM link on the official website

Implementing NPM link in plugins that you’ve created is very convenient for installing your own stuff so that you can process it and test it iteratively without constantly rebuilding it.

Add the global folder /usr/local/mode_modules/ XXXXXXX. Create a symbolic link in. The symbol (XXXXXXX) receives the NPM Link execution command package. It also puts any… Wow li la behind read not understand the Chinese also do not understand the kind of;

If you want to run the esLint plugin in another local project, use the NPM link ‘XXXXXXXXXX’ to link to the NPM link of your plugin;

Get the plugin name and link it so that your project is successfully bound to the plugin’s ESLint;

In the.eslintrc.js project, you don’t need to configure parameters,

Module. exports returns globally shared variables or methods.

const path = require(“path”) . This is the throw method.

I am a little bit whiter, always see the official website quote is like this

Module. exports = {“extends”:”eslint-config-yoshu”} this is what I did when I showed my manager…

module.exports = {
"extends":"eslint-config-demo"
}
Copy the code

It was later changed

Extends: ["eslint-config-demo"]Copy the code

I’ll write it like this

This will finally bring the whole ESLint thing to an end

NPM link eslint-config-demo…

There is still no validation for ESLint. I don’t think this is gonna work

The supervisor says you didn’t install dependencies and you have to introduce package dependencies

Such as “@ vue/typescript/it”, “@ vue/prettier”, “@ vue/prettier / @ typescript – eslint”…

Is to pretend to rely on

All right, time for the morning is over… Eat, sleep, brush, tiktok…


The afternoon began again

A: ok

M: No inner thought… I don’t know where the fuck the dependency is supposed to be.

Meng force in…

The plugin I wrote lacks dependencies… Then fake it.

A: Why don’t you come over here and tell me how and what to install… Okay, didn’t get a good look…

All right, the code is just copied…

“DevDependencies” “devDependencies” “devDependencies” The level of authenticity under Google Translate is limited

Development depends on dev… Rely on the dependencies… That’s crazy.

Timid ask us if this is to install development dependencies or dependencies… Forget what I said

Anyway, I ended up splitting it again…

Helpless very.. Irritated!

And I am confused about the NPM error

ah Is to play

Let’s just Google translate. Can’t read what and what

Depending on the problem we NPM I go. NPM I can not za CNPM I also can not!! Delete node_modules and I’ll start again ~

What a blind copy.

I have to pretend to be dependent.

I found package.json in a newly created vue project. It looks like a package. Get it over here first

That’s it. That’s it. Exactly. This is what?? Incredible stuff. Just explain to me what I’m going to pick up around vue, ESLint and typescript, okay

Ash ~ success is just around the corner. Come on, old iron

NPM link eslint-config runs ~ run

No effect…

Cancel the changes, nice works perfectly… Change my local plug-in is over ????? A hundred question marks

Find the problem. The double quotes are automatically formatted as single quotes when saved in the created index.js file… (found by A)

I’m nima? Vscode is used in settings.json configuration

Of course I didn’t change my Settings configuration but I created it

.eslintignore files ignore specific files and directories good!

Don’t format the contents of my file

Woc feels better better

npm link eslint-config ……….

I can’t

Start to find out why. Here comes A. Rm -r package-lock.json delete configuration NPM cache chean -f… Don’t know. There may also be cache issues when removing dependencies. NPM cache chean -f // NPM cache clean –force

Pack… I didn’t solve it

A: Wait until I upload A plugin package

M: Ok. Waiting for ⌛ ️

.

.

.

.

Good try

npm link eslint-config-test

“Remove the semicolon to red, contorl+ S repair” good

What’s wrong with me??

Check check…

The plugin name has been changed to eslint-config.

The official website says the format is eslint-config-xxxx, so I changed it

In fact, the middle of the mentality is a bit collapsed… It is completely muddled and needs to subdivide all in index.js. That’s what happens next.

NPM I eslint-config-ysy -d NPM I eslint-config-ysy -d NPM I eslint-config-ysy -d NPM I eslint-config-ysy -d NPM I eslint-config-ysy -d joke

This is the finished product. As long as the configuration is oJBK

You don’t have to write so much configuration in the project’s eslintrc

I like to open the terminal in vscode to operate directly. The awkward thing was that I had to switch the editor back and forth to operate the terminal.

Eternal God! from