Skip to content

Commit c0c37e6

Browse files
authored
Base eslint configuration (#1408)
1 parent 7b31b8b commit c0c37e6

File tree

8 files changed

+153
-63
lines changed

8 files changed

+153
-63
lines changed

.eslintrc

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
prettier_extensions: js,cjs,mjs,md,json,yml,yaml
5050
eslint: true
5151
eslint_args: '--max-warnings 0'
52-
eslint_extensions: js
52+
eslint_extensions: js,mjs,cjs
5353

5454
- name: Build
5555
run: npm run build

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"editor.formatOnSaveMode": "file",
3333
"editor.tabSize": 2,
3434
"editor.codeActionsOnSave": {
35-
"source.fixAll.eslint": "explicit"
35+
"source.fixAll.eslint": "never"
3636
},
3737
"files.trimTrailingWhitespace": true,
3838
"prettier.useEditorConfig": false

eslint.config.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import js from '@eslint/js';
2+
import babelParser from '@babel/eslint-parser';
3+
import prettierRecommended from 'eslint-plugin-prettier/recommended';
4+
import { defineConfig } from 'eslint/config';
5+
6+
export default defineConfig([
7+
js.configs.recommended,
8+
prettierRecommended,
9+
10+
{
11+
languageOptions: {
12+
ecmaVersion: 2021,
13+
},
14+
},
15+
16+
{
17+
files: ['**/*.{js,mjs}'],
18+
languageOptions: {
19+
sourceType: 'module',
20+
parser: babelParser,
21+
parserOptions: {
22+
ecmaVersion: 2021,
23+
},
24+
},
25+
rules: {
26+
strict: ['error', 'safe'],
27+
complexity: ['error', { max: 35 }],
28+
'no-prototype-builtins': 'off',
29+
'no-redeclare': 'off',
30+
'no-undef': 'off',
31+
'no-unused-vars': 'off',
32+
'no-useless-escape': 'off',
33+
},
34+
},
35+
36+
{
37+
files: ['**/*.cjs'],
38+
languageOptions: {
39+
sourceType: 'commonjs',
40+
},
41+
rules: {
42+
strict: 'off',
43+
'no-undef': 'off',
44+
},
45+
},
46+
{
47+
ignores: ['dist', 'examples', 'node_modules', 'vendor', 'coverage'],
48+
},
49+
]);

eslint.config.mjs

Lines changed: 0 additions & 33 deletions
This file was deleted.

package-lock.json

Lines changed: 98 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@
101101
"chai": "^5.3.3",
102102
"es-check": "^9.1.4",
103103
"eslint": "^9.24.0",
104+
"eslint-config-prettier": "^10.1.8",
105+
"eslint-plugin-prettier": "^5.5.4",
104106
"express": "^4.21.2",
105107
"glob": "^5.0.14",
106108
"mocha": "^11.1.0",
@@ -121,7 +123,7 @@
121123
"test:server": "mocha 'test/server.*.test.js' --reporter spec",
122124
"test:wtr": "web-test-runner",
123125
"test:wtr:watch": "web-test-runner --watch",
124-
"lint": "./node_modules/.bin/eslint .",
126+
"lint": "eslint",
125127
"format": "prettier --write \"**/*.{js,cjs,mjs,md,json,yml,yaml}\"",
126128
"format:check": "prettier --check \"**/*.{js,cjs,mjs,md,json,yml,yaml}\"",
127129
"pack": "node scripts/pack.js",

src/browser/telemetry.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ class Instrumenter {
629629
const c = this._window.console;
630630

631631
function wrapConsole(method) {
632+
// eslint-disable-next-line strict
632633
'use strict'; // See https://github.com/rollbar/rollbar.js/pull/778
633634

634635
const orig = c[method];

0 commit comments

Comments
 (0)