mirror of
https://github.com/thangisme/notes.git
synced 2025-09-24 07:54:16 -04:00
Initial commit
This commit is contained in:
27
node_modules/stylelint/lib/postcssPlugin.js
generated
vendored
Normal file
27
node_modules/stylelint/lib/postcssPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/* @flow */
|
||||
"use strict"
|
||||
const _ = require("lodash")
|
||||
const createStylelint = require("./createStylelint")
|
||||
const postcss = require("postcss")
|
||||
const path = require("path")
|
||||
|
||||
module.exports = postcss.plugin("stylelint", function (options) {
|
||||
options = options || {}
|
||||
|
||||
const tailoredOptions/*: Object*/ = options.rules
|
||||
? { config: options }
|
||||
: options
|
||||
const stylelint = createStylelint(tailoredOptions)
|
||||
|
||||
return (root, result) => {
|
||||
let filePath = options.from || _.get(root, "source.input.file")
|
||||
if (filePath !== undefined && !path.isAbsolute(filePath)) {
|
||||
filePath = path.join(process.cwd(), filePath)
|
||||
}
|
||||
|
||||
return stylelint._lintSource({
|
||||
filePath,
|
||||
existingPostcssResult: result,
|
||||
})
|
||||
}
|
||||
})
|
Reference in New Issue
Block a user