autolesshint
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -19,4 +19,10 @@ "use strict"; | ||
SingleLinePerSelectorSuggester.prototype.suggestMutation = function (complaint, config, fileInfo) { | ||
// The selector can somehow be the first line in the file | ||
// See https://github.com/automutate/autolesshint/issues/65 | ||
var sourceLine = fileInfo.linesRaw[complaint.line - 1]; | ||
if (sourceLine === undefined) { | ||
return undefined; | ||
} | ||
// The first property in a line shouldn't have a newline added | ||
if (!/\S/.test(fileInfo.linesRaw[complaint.line - 1].substring(0, complaint.column - 1))) { | ||
if (!/\S/.test(sourceLine.substring(0, complaint.column - 1))) { | ||
return undefined; | ||
@@ -36,2 +42,2 @@ } | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9zdWdnZXN0ZXJzL3NpbmdsZUxpbmVQZXJTZWxlY3RvclN1Z2dlc3Rlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUlBLGtDQUE2QztBQUU3Qzs7R0FFRztBQUNIO0lBQUE7SUF1QkEsQ0FBQztJQXRCRzs7Ozs7OztPQU9HO0lBQ0ksd0RBQWUsR0FBdEIsVUFBdUIsU0FBNkIsRUFBRSxNQUFZLEVBQUUsUUFBbUI7UUFDbkYsOERBQThEO1FBQzlELEVBQUUsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxJQUFJLEdBQUcsQ0FBQyxDQUFDLENBQUMsU0FBUyxDQUFDLENBQUMsRUFBRSxTQUFTLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ3ZGLE1BQU0sQ0FBQyxTQUFTLENBQUM7UUFDckIsQ0FBQztRQUVELE1BQU0sQ0FBQztZQUNILFNBQVMsRUFBRSx5QkFBaUIsQ0FBQyxRQUFRLENBQUMs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iAgICAgKiBAcGFyYW0gY29uZmlnICAgQ29uZmlndXJhdGlvbiBvcHRpb25zIGZvciB0aGUgcnVsZS5cclxuICAgICAqIEBwYXJhbSBmaWxlSW5mbyAgIENvbnRlbnRzIG9mIHRoZSBzb3VyY2UgZmlsZSBpbiB2YXJpb3VzIGZvcm1zLlxyXG4gICAgICogQHJldHVybnMgU3VnZ2VzdGVkIG11dGF0aW9uIGZvciB0aGUgZml4LlxyXG4gICAgICovXHJcbiAgICBwdWJsaWMgc3VnZ2VzdE11dGF0aW9uKGNvbXBsYWludDogSUxlc3NoaW50Q29tcGxhaW50LCBjb25maWc6IHZvaWQsIGZpbGVJbmZvOiBJRmlsZUluZm8pOiBJVGV4dEluc2VydE11dGF0aW9uIHwgdW5kZWZpbmVkIHtcclxuICAgICAgICAvLyBUaGUgZmlyc3QgcHJvcGVydHkgaW4gYSBsaW5lIHNob3VsZG4ndCBoYXZlIGEgbmV3bGluZSBhZGRlZFxyXG4gICAgICAgIGlmICghL1xcUy8udGVzdChmaWxlSW5mby5saW5lc1Jhd1tjb21wbGFpbnQubGluZSAtIDFdLnN1YnN0cmluZygwLCBjb21wbGFpbnQuY29sdW1uIC0gMSkpKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICBpbnNlcnRpb246IGdldExpbmVicmVha1N0eWxlKGZpbGVJbmZvLmxpbmVzUmF3KSxcclxuICAgICAgICAgICAgcmFuZ2U6IHtcclxuICAgICAgICAgICAgICAgIGJlZ2luOiBjb21wbGFpbnQucG9zaXRpb25cclxuICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgdHlwZTogXCJ0ZXh0LWluc2VydFwiXHJcbiAgICAgICAgfTtcclxuICAgIH1cclxufVxyXG4iXX0= | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi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4gICAgICovXHJcbiAgICBwdWJsaWMgc3VnZ2VzdE11dGF0aW9uKGNvbXBsYWludDogSUxlc3NoaW50Q29tcGxhaW50LCBjb25maWc6IHZvaWQsIGZpbGVJbmZvOiBJRmlsZUluZm8pOiBJVGV4dEluc2VydE11dGF0aW9uIHwgdW5kZWZpbmVkIHtcclxuICAgICAgICAvLyBUaGUgc2VsZWN0b3IgY2FuIHNvbWVob3cgYmUgdGhlIGZpcnN0IGxpbmUgaW4gdGhlIGZpbGVcclxuICAgICAgICAvLyBTZWUgaHR0cHM6Ly9naXRodWIuY29tL2F1dG9tdXRhdGUvYXV0b2xlc3NoaW50L2lzc3Vlcy82NVxyXG4gICAgICAgIGNvbnN0IHNvdXJjZUxpbmUgPSBmaWxlSW5mby5saW5lc1Jhd1tjb21wbGFpbnQubGluZSAtIDFdO1xyXG4gICAgICAgIGlmIChzb3VyY2VMaW5lID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIC8vIFRoZSBmaXJzdCBwcm9wZXJ0eSBpbiBhIGxpbmUgc2hvdWxkbid0IGhhdmUgYSBuZXdsaW5lIGFkZGVkXHJcbiAgICAgICAgaWYgKCEvXFxTLy50ZXN0KHNvdXJjZUxpbmUuc3Vic3RyaW5nKDAsIGNvbXBsYWludC5jb2x1bW4gLSAxKSkpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgIGluc2VydGlvbjogZ2V0TGluZWJyZWFrU3R5bGUoZmlsZUluZm8ubGluZXNSYXcpLFxyXG4gICAgICAgICAgICByYW5nZToge1xyXG4gICAgICAgICAgICAgICAgYmVnaW46IGNvbXBsYWludC5wb3NpdGlvblxyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICB0eXBlOiBcInRleHQtaW5zZXJ0XCJcclxuICAgICAgICB9O1xyXG4gICAgfVxyXG59XHJcbiJdfQ== |
{ | ||
"name": "autolesshint", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Automagically fixes lesshint errors in .less files.", | ||
@@ -5,0 +5,0 @@ "index": "bin/autolesshint", |
@@ -20,4 +20,11 @@ import { ITextInsertMutation } from "automutate/lib/mutators/textInsertMutator"; | ||
public suggestMutation(complaint: ILesshintComplaint, config: void, fileInfo: IFileInfo): ITextInsertMutation | undefined { | ||
// The selector can somehow be the first line in the file | ||
// See https://github.com/automutate/autolesshint/issues/65 | ||
const sourceLine = fileInfo.linesRaw[complaint.line - 1]; | ||
if (sourceLine === undefined) { | ||
return undefined; | ||
} | ||
// The first property in a line shouldn't have a newline added | ||
if (!/\S/.test(fileInfo.linesRaw[complaint.line - 1].substring(0, complaint.column - 1))) { | ||
if (!/\S/.test(sourceLine.substring(0, complaint.column - 1))) { | ||
return undefined; | ||
@@ -24,0 +31,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
249005
3469