Tag Archives: Front end development

Turn off eslint checksum and resolve formatting conflicts

Turn off eslint verification

1. Modify the following code for index.js in config

    useEslint: false,

2. The universal method is to write in the first line of the error reporting JS file

/* eslint-disable */

3. There is a file. Eslintignore file in the root directory. You can add files that you do not need to verify.
for example, if you do not want it to verify Vue files, add. Vue. Of course, this will make all Vue files not verified. Similarly,. JS does not verify all JS files.
4. Open the extension of vscode editor and enter eslint search, Disable the eslint extension to solve the problem fundamentally
5. Check as shown in the figure to cancel the error reporting, restart vscode, and no error will be reported during compilation

6. Change the verification rule to 0 (0 means no verification, 1 means warning, 2 means error reporting)

 rules: {
    'vue/html-self-closing': 0,
    'vue/html-indent': 0,
    'vue/max-attributes-per-line': [
      1,
      {
        singleline: 10,
        multiline: {
          max: 4,
          allowFirstLine: true
        }
      }
    ],
  }

7. Directly modify the configuration file vue.config.js

module.exports = {
  lintOnSave: false
}

Causes and solutions of configuration conflict between eslint and prettier in vscode

Vscode uses the eslint plug-in and the prettier plug-in. The settings.json configuration of the editor is as follows:

{
  "editor.formatOnSave": true, // Auto-formatting on save
    "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode", // use prettier when formatting
  },
  "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true // use eslint to verify files when saving
    }
}

Eslint, prettier, eslint config prettier, eslint plugin prettier
are installed in the project. Pretierrc is added to the root directory

{
    "singleQuote": true,
    "semi": true,
}

Path cannot be used with params in this. $router. Push() method, otherwise params will be invalid

Path in this. $router. Push() method cannot be used with params, otherwise params will be invalid!!

This. $router.push can pass parameters in two ways:

The first one is the first one

Pass parameters -- this.$router.push({path: ' route ', query: {key: value}})

Parameter fetch -- this.$route.query.key

With this approach, the passed parameters are spliced after the route and appear in the address bar.

Second:

Passing parameters -- this.$router.push({name: ' name of route ', params: {key: value}})

Parameters take values -- this.$route.params.key

With this approach, the parameters are not spliced behind the route and are not visible on the address bar...

Dynamic routing also passes params, so in this. $router. Push() method, path cannot be used with params, otherwise params will be invalid. You need name to specify the page.

[access through the name attribute of routing configuration]

[Solved] This is probably not a problem with npm. There is likely additional logging output above.

If this error occurs, you need to re install the node_ Contents in the modules folder   But before installing, you should clear all the previous contents. The steps are as follows:

1. Delete the node first_ modules

rmdir /s/q node_modules

2.delete package-lock.json file
3.npm cache clean –force
4.npm install(npm i is ok)

Error in mounted hook: “TypeError: Cannot read property ‘init‘ of undefined“

Error in mounted hook: “TypeError: Cannot read property ‘init’ of undefined”

let myChart = this.$echarts.init(document.getElementById('radar1'))

Error reason: ecarts version is too high, after unloading. Install lower version:

cnpm install [email protected] -S

  However, it is found that there are still errors:

Error: ENOENT: no such file or directory, open

terms of settlement:

Restart the service. Recompile!

Error: enoent: no such file or directory, stat ‘/ usr / local / var / www / /_ book/gitbook/git

Every time a gitbook is edited, there will be an error that causes the service that has been started through gitbook serve to stop. The error message is: error: enoent: no such file or directory, stat ‘/ usr/local/var/www//_ book/gitbook/gitbook-plugin-livereload/ plugin.js ‘

The background is that a new gitbook has been installed. Every time I edit the MD file in the project, I will hold the above error. As a result, the service I started through gitbook serve will stop and I can’t browse the edited gitbook normally

At the beginning, I didn’t care when I reported the error. The back office revised and edited the file several times, and found that the gitbook service would stop and report the above error after each modification. I found that this was not a mistake in my operation, but a problem with gitbok. After looking for the problem for a while, I didn’t have any idea, so I Baidu found out the bug in gitbook itself, The original configuration of gitbook is wrong. The specific modification method is as follows:

1. Find the configuration file address of gitbook (MAC system) in the user directory: Cd ~ to jump to the user directory of the current user

2. Find ~ /. Gitbook/versions/3.2.3/lib/output/website/ copyPluginAssets.js File, and then find all the confirm configuration items in this file (a total of 2 places), and change the original value of true to false

confirm: false

There are two places in total. Just change them

After eclipse eclipse eclipse imports the correct project, an error is reported in XML and other files

I use eclipse ide to import a correct project. Some XML configuration files and JSP pages report errors. Click in to view the specific errors. XML files report errors in some header files, and JSP functions. But others did not report mistakes.

This is because the files we wrote are not written in strict accordance with the relevant rules of J2EE, but the operation will not make mistakes, as long as we do not let the project configuration select these.

resolvent:

Step 1: Project Explorer (if you don’t have this window, you can select an inverted triangle sign in the eclipse toolbar – & gt; window – & gt; show view – & gt; Project Explorer) – & gt; select the customize view (as shown in Figure 1) – & gt; content tab – & gt; and remove some J2EE and the last option (as shown in Figure 2 – available customization).

Figure 1

Figure 2

Step 2: Eclipse toolbar – & gt; window – & gt; preferences – & gt; validation – & gt; click the “disable all” button – & gt; OK/apply (as shown in the figure)

Step 3: clean the project and rebuild it.

After eclipse Eclispe imports the correct project, XML appears

Original text: http://blog.csdn.net/u013147600/article/details/47102971