Skip to content

Developer Guide

Alex X edited this page Aug 24, 2023 · 3 revisions

PyCharm ESLint

Example: Windows + PyCharm + ESLint

  1. Install NodeJS: C:\Node2005\

  2. Install eslint globally

npm install -g eslint
npm install -g eslint-plugin-html
  1. Set env NODE_PATH=c:\Node2005\node_modules\

  2. Setup PyCharm: [x] Manual ESLint configuration: C:\Node2005\node_modules\eslint

  3. Add package.json to root of your project

{
  "devDependencies": {
    "eslint": "^8.44.0",
    "eslint-plugin-html": "^7.1.0"
  },
  "eslintConfig": {
    "env": {
      "browser": true,
      "es6": true
    },
    "parserOptions": {
      "ecmaVersion": 2017,
      "sourceType": "module"
    },
    "rules": {
      "no-var": "error",
      "no-undef": "error",
      "no-unused-vars": "warn",
      "prefer-const": "error",
      "quotes": [
        "error",
        "single"
      ],
      "semi": "error"
    },
    "plugins": [
      "html"
    ],
    "overrides": [
      {
        "files": [
          "*.html"
        ],
        "parserOptions": {
          "sourceType": "script"
        }
      }
    ]
  }
}
Clone this wiki locally