Giter Club home page Giter Club logo

vscode-puglint's Introduction

vscode-puglint

This linter plugin for VS Code provides an interface to pug-lint.

puglint

Installation

Linter installation is performed in several stages:

  1. Install pug-lint use npm i -D pug-lint or npm i -g pug-lint.
  2. Press F1 and select Extensions: Install Extensions.
  3. Search and choose vscode-puglint.

See the extension installation guide for details.

Usage

Enable the linter in the VS Code settings.

{
  "puglint.enable": true
}

Configurations

The plugin supports the following files:

  • .jade-lintrc or .jade-lint.json
  • .pug-lintrc, .pug-lintrc.js, .pug-lintrc.json or .pug-lint.json
  • pugLintConfig section in the package.json file

The rules for determining the configuration file:

  1. Editor settings
  2. Workspace config (current project)
  3. Package file (current project)
  4. Global config ($HOME directory)
  5. Default config {}

Supported languages

  • Pug
  • Jade

Supported settings

puglint.enable

  • Type: Boolean
  • Default: false

Control whether puglint is enabled for Pug/Jade files or not.

puglint.run

  • Type: String
  • Default: onType
  • Supported values: onType, onSave

Run the linter on save (onSave) or on type (onType).

puglint.config

  • Type: Object
  • Default: {}

Will be directly passed to config option.

For example:

{
  "puglint.enable": true,
  "puglint.config": {
    "requireClassLiteralsBeforeIdLiterals": true
  }
}

Examples for use extends (don't forget to install config, for example pug-lint-config-clock):

{
  "puglint.enable": true,
  "puglint.config": {
    "extends": "clock"
  }
}

More information: pug-lint: extends

Changelog

See the Releases section of our GitHub project for changelogs for each release version.

License

This software is released under the terms of the MIT license.

vscode-puglint's People

Contributors

mrmlnc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cspotcode

vscode-puglint's Issues

Exclude Files option won't work in VScode

Hi! I have a strange problem with ignoring some files from linting: I have UI error messages from files that must be ignore according my .pug-lintrc config but meantime cli successfully ignore excluded files and doesn't show any errors.

For example my .pug-lintrc file looks like:
{ _My rules here_ "excludeFiles": ["src/pages/**"] }

VScode shows me errors in src/pages/** files.
image

But cli command npx pug-lint src/pages doesn't inform me about any errors in src/pages/** files.
I can't understand why is it happening. I will be happy for any help with it issue.

OS: Ubuntu 21.04 hirsute
DE: KDE 5.80.0 / Plasma 5.21.4
Vscode 1.57.0
pug-lint: 2.6.0
vscode-pug-lint: 2.3.0

Should look for rule set up the directory tree

In my project I have server and client code in separate sub-directories of my project directory. If I put the .pug-lintrc file in the project root, the plugin sees it and works properly. If I put the .pug-lintrc file in the client directory (since it's client-specific) the plugin does not see the file, even if the .pug file is in a child directory of where the rule set is. It should climb up the directory tree from the file until it finds a rule set.

Run for subdirectories

First: This plugin has done a great job during the last years -- thanks for this!

We have recently restructured our repository and split it into sub-projects and during this, we have moved some configuration files to subdirectories. The structure now looks like this:

+-- subproject-a
|     +-- src
|     |     +-- pug-files
|     +-- .pug-lintrc.js
|     +-- package.json
+-- subproject-b
+-- subproject-c

Since then, the puglint plugin unfortunately no longer works for us. If I interpret the code correctly, the plugin only seems to check the root path only. (this is different to how e.g. VS Code behaves -- there I can e.g. have individual and different tsconfig.json instances for the sub projects)

The following workarounds seem to work:

  • additionally install pug-lint in the repository’s root, and add a .pug-lintrc.js there as well (our build process requires it to be present in subproject-a). To reduce duplication, I used:

    module.exports = require('./subproject-a/.pug-lintrc.js');
    
  • open subproject-a instead of the repo’s root -- this way, unfortunately we’re losing context.

Is there something I’m missing or a better fix or workaround for this?

Drop support for presets

Hi

With pugjs/pug-lint#79, I'm going to be dropping support for presets in favour of extending config from external resources, so just wanted to let you know as I see you are using one in some of your tests

Run pug-lint from `node_modules`

I would like it if the extension ran pug-lint from node_modules instead of globally, because this has been my experience.

  1. Install the extension.
  2. There are no error messages and nothing happens.
  3. Install pug-lint globally.
  4. Now it works.

This means that I have to make sure everyone on my team runs the same pug-lint version, and I have to update a wiki telling everyone which version of pug-lint to install on their machine. When people forget to do this, they check in code with problems, and don't know about them until the CI server tells them. It's easier if the extension just detects pug-lint from node_modules, and runs that.

Component file support

Is it possible to get support for files such as .vue which contain a <template> <style> and <script> tag?

Example:

<template lang='pug'>
  #app
    | this is my app
</template>

<script>
</script>

<style lang='scss'>
</style>

puglint on vscode 1.31.0 parameter error

Running on Windows 8.1 x64, I just upgraded VSCode to latest 1.31.0, and installed your plugin, enabled it to run on save in settings.

I have pug-lint installed globally by npm i -g pug-lint. Source files are accessed remote via ssh-fs.

On every save I get the error The "path" argument must be of type string. Received type object,
which I guess is because of the pug-lint --config <path> parameter is either missing or wrong.

So, what are my options in this scenario?

Is there somewhere I can set the --config <path> ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.