Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eslint to project and format files in project #244

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
env: {
es6: true
},
parserOptions: {
ecmaVersion: 8,
sourceType: "module"
},
rules: {
indent: ["error", 2],
"linebreak-style": ["error", "unix"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are enforcing a linebreak style then a .gitattributes file is also needed for Window's users where git's setting for line-endings is going to default to CRLF on checkout.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you prefer removing the linebreak style check in lint or adding a gitattributes file ? Seems like most of the code base has CRLF

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need both. Git doesn't really have anything to do with linting but the opposite is not true. Linting will give errors if you checkout this repo on windows without a .gitattributes file and the eslint rc line-endings are set to LF.

But the files are actually LF. If you run git ls-files --eol then you will see that the index (the first column of output) shows all to be LF.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion is to break as little as possible.

If we swap to unix linting then you must add a .gitattributes file for windows users so they checkout as LF. This would require users to reclone their repos.

That file would look like this:

* text=auto eol=lf

Or keep rules without linebreak-style but make sure they are converted to LF when added to the index

* text=auto

I think the least intrusive option is the 2nd as it doesn't require everyone to reclone. Unless there is a way to get the line-endings fixed without cloning.

quotes: ["error", "double"],
semi: ["error", "always"]
}
};
2 changes: 1 addition & 1 deletion data/pop-js/burroughs-rift.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const string_cheeses = [
"Swiss String",
"Brie String",
"Magical String"
]
];

module.exports = {
default: {
Expand Down
18 changes: 9 additions & 9 deletions data/pop-js/cantera-quarry.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const utils = require("../_utils")
const utils = require("../_utils");

module.exports = {
series: [
{
cheese: utils.genVarField('cheese', [
'Bland Queso',
'Mild Queso',
'Medium Queso',
'Hot Queso',
'Flamin\' Queso',
cheese: utils.genVarField("cheese", [
"Bland Queso",
"Mild Queso",
"Medium Queso",
"Hot Queso",
"Flamin' Queso",
]),
location: utils.genVarField('location', 'Cantera Quarry'),
location: utils.genVarField("location", "Cantera Quarry"),
}
]
}
};
14 changes: 7 additions & 7 deletions data/pop-js/floating-islands.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const palace_stage_mods = [
"Empyrean Seal Stowage",
"Ore and Glass Deposit",
"Sky Pirate Den",
]
];

const island_configurations = {
Arcane: {
Expand Down Expand Up @@ -162,7 +162,7 @@ const island_configurations = {
Palace: "Tactical Maze"
},
},
}
};

var config = {
default: {
Expand Down Expand Up @@ -288,13 +288,13 @@ function generatePalaceStages(stage) {
* @returns {string[]}
*/
function generateLootCacheStages(islandStages) {
var stages = []
var stages = [];
for (let stage of [islandStages.Low, islandStages.High]) {
stages.push(`${stage} - Loot x2`)
stages.push(`${stage} - Loot x2`);
}

for (let i = 2; i <= 4; i++) {
stages.push(`${islandStages.Palace} - Loot x${i}`)
stages.push(`${islandStages.Palace} - Loot x${i}`);
}
return stages;
}
Expand Down Expand Up @@ -323,7 +323,7 @@ function generateConfig() {
},
},
],
}
};
config.series.push(series);
}
}
Expand All @@ -346,7 +346,7 @@ function generateConfig() {
},
},
],
}
};
config.series.push(series);
}

Expand Down
52 changes: 26 additions & 26 deletions data/pop-js/foreword-farm.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const utils = require("../_utils")
const utils = require("../_utils");

const standardCheese = ['Gouda', 'SB+'];
const standardCheese = ["Gouda", "SB+"];

module.exports = {
default: {
location: utils.genVarField('location', 'Foreword Farm'),
location: utils.genVarField("location", "Foreword Farm"),
},
series: [
{
Expand All @@ -13,10 +13,10 @@ module.exports = {
config: [ {
opts: {
include: [
'Grit Grifter',
'Land Loafer',
'Root Rummager',
'Crazed Cultivator'
"Grit Grifter",
"Land Loafer",
"Root Rummager",
"Crazed Cultivator"
]
}
} ]
Expand All @@ -27,10 +27,10 @@ module.exports = {
config: [ {
opts: {
include: [
'Angry Aphid',
'Grit Grifter',
'Root Rummager',
'Crazed Cultivator'
"Angry Aphid",
"Grit Grifter",
"Root Rummager",
"Crazed Cultivator"
]
}
} ]
Expand All @@ -41,10 +41,10 @@ module.exports = {
config: [ {
opts: {
include: [
'Angry Aphid',
'Grit Grifter',
'Wily Weevil',
'Crazed Cultivator'
"Angry Aphid",
"Grit Grifter",
"Wily Weevil",
"Crazed Cultivator"
]
}
} ]
Expand All @@ -55,10 +55,10 @@ module.exports = {
config: [ {
opts: {
include: [
'Angry Aphid',
'Mighty Mite',
'Wily Weevil',
'Crazed Cultivator'
"Angry Aphid",
"Mighty Mite",
"Wily Weevil",
"Crazed Cultivator"
]
}
} ]
Expand All @@ -69,11 +69,11 @@ module.exports = {
config: [ {
opts: {
include: [
'Angry Aphid',
'Mighty Mite',
'Wily Weevil',
'Crazed Cultivator',
'Loathsome Locust'
"Angry Aphid",
"Mighty Mite",
"Wily Weevil",
"Crazed Cultivator",
"Loathsome Locust"
]
}
} ]
Expand All @@ -84,10 +84,10 @@ module.exports = {
config: [ {
opts: {
include: [
'Monstrous Midge'
"Monstrous Midge"
]
}
} ]
},
]
}
};
Loading