Skip to content

Commit 585bd25

Browse files
committed
set up ESLint
1 parent c8c85d4 commit 585bd25

6 files changed

Lines changed: 750 additions & 20 deletions

File tree

.circleci/config.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ jobs:
2929
install-chrome: false
3030
install-chromedriver: false
3131

32-
# - node/install:
33-
# node-version: 16.13.1
34-
# install-yarn: true
32+
- node/install:
33+
node-version: lts
3534

3635
- run:
3736
name: Which bundler?
@@ -55,19 +54,8 @@ jobs:
5554
paths:
5655
- vendor/bundle
5756

58-
# - restore_cache:
59-
# keys:
60-
# - yarn-{{ checksum "yarn.lock" }}
61-
# - yarn-
62-
63-
# - run:
64-
# name: Yarn Install
65-
# command: yarn install --cache-folder ~/.cache/yarn
66-
67-
# - save_cache:
68-
# key: yarn-{{ checksum "yarn.lock" }}
69-
# paths:
70-
# - ~/.cache/yarn
57+
- node/install-packages:
58+
pkg-manager: pnpm
7159

7260
- run:
7361
name: Wait for DB
@@ -81,9 +69,9 @@ jobs:
8169
# name: Brakeman
8270
# command: bundle exec brakeman
8371

84-
# - run:
85-
# name: Stylelint
86-
# command: yarn stylelint
72+
- run:
73+
name: ESLint
74+
command: pnpm lint
8775

8876
- run:
8977
name: Rubocop

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ spec/examples.txt
2929
# Ignore local .env files
3030
*.local
3131
.env
32+
33+
/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)