Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 5f02fdc

Browse files
author
steelbrain
committed
🆕 Add steelbrain-legacy as a babel preset
1 parent 1b0aa25 commit 5f02fdc

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

.ucompilerrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"path": "src/*.js",
55
"outputPath": "lib/{name}.js",
66
"babel": {
7-
"presets": ["steelbrain"]
7+
"presets": ["steelbrain", "steelbrain-legacy"]
88
}
99
}]
1010
}

lib/main.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ exports.default = {
6868
}
6969
},
7070
activate: function () {
71+
var _this = this;
72+
7173
require('atom-package-deps').install();
7274

7375
this.subscriptions = new _atom.CompositeDisposable();
@@ -76,17 +78,17 @@ exports.default = {
7678
this.scopes = ['source.js', 'source.jsx', 'source.js.jsx', 'source.babel', 'source.js-semantic'];
7779

7880
const embeddedScope = 'source.js.embedded.html';
79-
this.subscriptions.add(atom.config.observe('linter-eslint.lintHtmlFiles', lintHtmlFiles => {
81+
this.subscriptions.add(atom.config.observe('linter-eslint.lintHtmlFiles', function (lintHtmlFiles) {
8082
if (lintHtmlFiles) {
81-
this.scopes.push(embeddedScope);
83+
_this.scopes.push(embeddedScope);
8284
} else {
83-
if (this.scopes.indexOf(embeddedScope) !== -1) {
84-
this.scopes.splice(this.scopes.indexOf(embeddedScope), 1);
85+
if (_this.scopes.indexOf(embeddedScope) !== -1) {
86+
_this.scopes.splice(_this.scopes.indexOf(embeddedScope), 1);
8587
}
8688
}
8789
}));
8890
this.subscriptions.add(atom.commands.add('atom-text-editor', {
89-
'linter-eslint:fix-file': () => {
91+
'linter-eslint:fix-file': function () {
9092
const textEditor = atom.workspace.getActiveTextEditor();
9193
const filePath = textEditor.getPath();
9294
const fileDir = _path2.default.dirname(filePath);
@@ -97,13 +99,13 @@ exports.default = {
9799
return;
98100
}
99101

100-
if (this.worker === null) {
102+
if (_this.worker === null) {
101103
// Abort if worker is not yet ready
102104
atom.notifications.addError('Linter-ESLint: Not ready, please try again');
103105
return;
104106
}
105107

106-
this.worker.request('FIX', {
108+
_this.worker.request('FIX', {
107109
fileDir: fileDir,
108110
filePath: filePath,
109111
global: atom.config.get('linter-eslint.useGlobalEslint'),
@@ -121,18 +123,18 @@ exports.default = {
121123
// process while atom is starting up, it can increase startup
122124
// time by several seconds, But if we do this after 5 seconds,
123125
// we barely feel a thing.
124-
const initializeWorker = () => {
125-
if (this.active) {
126+
const initializeWorker = function () {
127+
if (_this.active) {
126128
var _spawnWorker = (0, _helpers.spawnWorker)();
127129

128130
const child = _spawnWorker.child;
129131
const worker = _spawnWorker.worker;
130132
const subscription = _spawnWorker.subscription;
131133

132-
this.worker = worker;
133-
this.subscriptions.add(subscription);
134-
child.on('exit-linter', shouldLive => {
135-
this.worker = null;
134+
_this.worker = worker;
135+
_this.subscriptions.add(subscription);
136+
child.on('exit-linter', function (shouldLive) {
137+
_this.worker = null;
136138
// Respawn if it crashed. See atom/electron#3446
137139
if (shouldLive) {
138140
initializeWorker();
@@ -147,13 +149,15 @@ exports.default = {
147149
this.subscriptions.dispose();
148150
},
149151
provideLinter: function () {
152+
var _this2 = this;
153+
150154
const Helpers = require('atom-linter');
151155
return {
152156
name: 'ESLint',
153157
grammarScopes: this.scopes,
154158
scope: 'file',
155159
lintOnFly: true,
156-
lint: textEditor => {
160+
lint: function (textEditor) {
157161
const text = textEditor.getText();
158162
if (text.length === 0) {
159163
return Promise.resolve([]);
@@ -162,7 +166,7 @@ exports.default = {
162166
const fileDir = _path2.default.dirname(filePath);
163167
const showRule = atom.config.get('linter-eslint.showRuleIdInMessage');
164168

165-
if (this.worker === null) {
169+
if (_this2.worker === null) {
166170
return Promise.resolve([{
167171
filePath: filePath,
168172
type: 'Info',
@@ -171,7 +175,7 @@ exports.default = {
171175
}]);
172176
}
173177

174-
return this.worker.request('JOB', {
178+
return _this2.worker.request('JOB', {
175179
fileDir: fileDir,
176180
filePath: filePath,
177181
contents: text,

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@
2323
},
2424
"devDependencies": {
2525
"babel-eslint": "^4.1.5",
26+
"babel-preset-steelbrain": "^1.0.0",
27+
"babel-preset-steelbrain-legacy": "^1.0.0",
2628
"eslint-config-airbnb": "latest",
2729
"eslint-config-steelbrain": "latest",
2830
"eslint-plugin-import": "^0.11.0",
2931
"eslint-plugin-react": "^3.10.0",
30-
"shelljs": "^0.5.3",
31-
"babel-preset-steelbrain": "^1.0.0"
32+
"shelljs": "^0.5.3"
3233
},
3334
"package-deps": [
3435
"linter"
@@ -46,7 +47,10 @@
4647
"no-empty": 0,
4748
"no-console": 0,
4849
"no-new": 0,
49-
"semi": [2, "never"]
50+
"semi": [
51+
2,
52+
"never"
53+
]
5054
},
5155
"parser": "babel-eslint",
5256
"globals": {

0 commit comments

Comments
 (0)