Skip to content

Commit 711d367

Browse files
author
Ben Newman
committed
Implement LintingFile#getFileOptions.
Fixes meteor#6414.
1 parent a737d43 commit 711d367

File tree

3 files changed

+43
-30
lines changed

3 files changed

+43
-30
lines changed

tools/isobuild/build-plugin.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,17 @@ _.extend(exports.InputFile.prototype, {
461461
var self = this;
462462
return files.pathDirname(self.getPathInPackage());
463463
},
464+
465+
/**
466+
* @summary Returns an object of file options such as those passed as the
467+
* third argument to api.addFiles.
468+
* @memberof InputFile
469+
* @returns {Object}
470+
*/
471+
getFileOptions: function () {
472+
throw new Error("Not Implemented");
473+
},
474+
464475
/**
465476
* @summary Call this method to raise a compilation or linting error for the
466477
* file.

tools/isobuild/compiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ function runLinters({inputSourceArch, isopackCache, sources,
717717
// sourceProcessor.id -> {sourceProcessor, sources: [WrappedSourceItem]}
718718
const sourceItemsForLinter = {};
719719
_.values(sources).forEach((sourceItem) => {
720-
const { relPath } = sourceItem;
720+
const { relPath, fileOptions } = sourceItem;
721721
const classification = sourceProcessorSet.classifyFilename(
722722
files.pathBasename(relPath), inputSourceArch.arch);
723723

@@ -739,7 +739,7 @@ function runLinters({inputSourceArch, isopackCache, sources,
739739
watchSet,
740740
files.pathResolve(inputSourceArch.sourceRoot, relPath));
741741
const wrappedSource = {
742-
relPath, contents, hash,
742+
relPath, contents, hash, fileOptions,
743743
arch: inputSourceArch.arch,
744744
'package': inputSourceArch.pkg.name
745745
};

tools/isobuild/linter-plugin.js

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
1-
var buildPluginModule = require('./build-plugin.js');
2-
var util = require('util');
3-
var _ = require('underscore');
1+
import { InputFile } from "./build-plugin.js";
42

5-
exports.LinterPlugin = function (pluginDefinition, userPlugin) {
6-
var self = this;
7-
self.userPlugin = userPlugin;
8-
self.pluginDefinition = pluginDefinition;
9-
};
10-
11-
var LintingFile = exports.LintingFile = function (source) {
12-
buildPluginModule.InputFile.call(this);
13-
14-
var self = this;
15-
self._source = source;
16-
};
3+
export class LinterPlugin {
4+
constructor(pluginDefinition, userPlugin) {
5+
this.pluginDefinition = pluginDefinition;
6+
this.userPlugin = userPlugin;
7+
}
8+
}
179

18-
util.inherits(LintingFile, buildPluginModule.InputFile);
10+
export class LintingFile extends InputFile {
11+
constructor(source) {
12+
super();
13+
this._source = source;
14+
}
1915

20-
_.extend(LintingFile.prototype, {
21-
getContentsAsBuffer: function () {
16+
getContentsAsBuffer() {
2217
return this._source.contents;
23-
},
24-
getPathInPackage: function () {
18+
}
19+
20+
getPathInPackage() {
2521
return this._source.relPath;
26-
},
27-
getPackageName: function () {
28-
return this._source['package'];
29-
},
30-
getSourceHash: function () {
22+
}
23+
24+
getPackageName() {
25+
return this._source["package"];
26+
}
27+
28+
getSourceHash() {
3129
return this._source.hash;
32-
},
33-
getArch: function () {
30+
}
31+
32+
getArch() {
3433
return this._source.arch;
3534
}
36-
});
3735

36+
getFileOptions() {
37+
return this._source.fileOptions || {};
38+
}
39+
}

0 commit comments

Comments
 (0)