Skip to content

Commit a8452e0

Browse files
committed
set up ESLint
1 parent c8c85d4 commit a8452e0

5 files changed

Lines changed: 744 additions & 1 deletion

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ spec/examples.txt
2929
# Ignore local .env files
3030
*.local
3131
.env
32+
33+
# Node
34+
/node_modules

app/assets/javascripts/application.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//= require backbone-min.js
88

99
_.templateSettings = {
10-
interpolate: /\{\{\=(.+?)\}\}/g,
10+
interpolate: /\{\{=(.+?)\}\}/g,
1111
evaluate: /\{\{(.+?)\}\}/g
1212
};
1313

eslint.config.mjs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
4+
export default [
5+
js.configs.recommended,
6+
{
7+
languageOptions: {
8+
sourceType: "script",
9+
globals: {
10+
...globals.browser,
11+
Backbone: "readonly",
12+
_: "readonly",
13+
$: "readonly",
14+
jQuery: "readonly",
15+
Mousetrap: "readonly",
16+
},
17+
},
18+
rules: {
19+
"no-var": "off",
20+
"no-unused-vars": "warn",
21+
},
22+
},
23+
{
24+
files: ["spec/javascript/spec/**"],
25+
languageOptions: {
26+
globals: {
27+
describe: "readonly",
28+
it: "readonly",
29+
before: "readonly",
30+
beforeEach: "readonly",
31+
afterEach: "readonly",
32+
sinon: "readonly",
33+
chai: "readonly",
34+
mocha: "readonly",
35+
initMochaPhantomJS: "readonly",
36+
Story: "readonly",
37+
StoryView: "readonly",
38+
StoryList: "readonly",
39+
},
40+
},
41+
},
42+
{
43+
ignores: ["vendor/", "coverage/", "spec/javascript/support/", "public/"],
44+
},
45+
];

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"lint": "eslint app/assets/javascripts/ spec/javascript/spec/"
5+
},
6+
"devDependencies": {
7+
"@eslint/js": "^9.21.0",
8+
"eslint": "^9.21.0",
9+
"globals": "^16.0.0"
10+
},
11+
"packageManager": "pnpm@10.4.1"
12+
}

0 commit comments

Comments
 (0)