Code Monkey home page Code Monkey logo

Comments (5)

mattlewis92 avatar mattlewis92 commented on June 12, 2024 1

Fixed in 1.3.1 🎉

from htmlhint-loader.

willpracht avatar willpracht commented on June 12, 2024

Wondering if I need to install htmlhint as a devDep, require it in my webpack.config.js, point options.htmlhint to it...

from htmlhint-loader.

willpracht avatar willpracht commented on June 12, 2024

I found the problem:

// index.js - line ~143
const options = Object.assign(
  {  // Loader defaults
    formatter: defaultFormatter,
    emitAs: null, // Can be either warning or error
    failOnError: false,
    failOnWarning: false,
    customRules: [],
    configFile: DEFAULT_CONFIG_FILE
  },
  this.options.htmlhint || {}, // PROBLEM
  loaderUtils.getOptions(this) // Loader query string
);

this.options does not exist in that context as this.options hasn't actually
been defined yet.

If I remove this line from the Object.assign(), things work.

I'm not sure of the original intent of the line, so I'm weary to just remove it
in a pull request no questions asked.

@mattlewis92: I'll submit a pull request to remove it, but please let me know
the original intent here and I can update the PR if necessary.

Thanks!

from htmlhint-loader.

alexan avatar alexan commented on June 12, 2024

I think this line is used to get user defaults from webpack.config:

const path = require('path');

module.exports = {
  entry: "./app/entry", 
  htmlhint: {
     user config
  }
}

the loader migration guide states explicitly that this feature where deprecated in webpack 3.0.0
https://medium.com/webpack/webpack-4-migration-guide-for-plugins-loaders-20a79b927202

Guideline: Loaders should receive all options via this.query. They should not use other ways to receive options, i. e. no property in webpack options, no environment variable.

  • maybe you should check if this.options is set in webpack 2-3 and log a dreprecation warning
  • if options is not available ignore it

from htmlhint-loader.

willpracht avatar willpracht commented on June 12, 2024

@mattlewis92 Thanks!

from htmlhint-loader.

Related Issues (14)

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.