Skip to content

Commit 5aad62b

Browse files
committed
Fix eslint config
1 parent 6e93b08 commit 5aad62b

File tree

3 files changed

+59
-62
lines changed

3 files changed

+59
-62
lines changed

eslint.config.mjs

Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,66 @@ import mocha from 'eslint-plugin-mocha';
22
import babel from '@babel/eslint-plugin';
33
import globals from 'globals';
44
import babelParser from '@babel/eslint-parser';
5-
import path from 'node:path';
6-
import { fileURLToPath } from 'node:url';
75
import js from '@eslint/js';
8-
import { FlatCompat } from '@eslint/eslintrc';
96

10-
const __filename = fileURLToPath(import.meta.url);
11-
const __dirname = path.dirname(__filename);
12-
const compat = new FlatCompat({
13-
baseDirectory: __dirname,
14-
recommendedConfig: js.configs.recommended,
15-
allConfig: js.configs.all
16-
});
7+
export default [
8+
js.configs.recommended,
9+
mocha.configs.recommended,
10+
{
11+
ignores: [
12+
'**/.DS_Store',
13+
'**/_sass',
14+
'**/_site',
15+
'**/coverage',
16+
'dist/*',
17+
'**/node_modules',
18+
'**/package-lock.json',
19+
'packages/*/dist/*',
20+
'**/.env',
21+
'**/.env.*',
22+
'!**/.env.example',
23+
],
24+
},
25+
{
26+
plugins: {
27+
'@babel': babel,
28+
},
1729

18-
export default [{
19-
ignores: [
20-
'**/.DS_Store',
21-
'**/_sass',
22-
'**/_site',
23-
'**/coverage',
24-
'dist/*',
25-
'**/node_modules',
26-
'**/package-lock.json',
27-
'packages/*/dist/*',
28-
'**/.env',
29-
'**/.env.*',
30-
'!**/.env.example',
31-
],
32-
}, ...compat.extends('eslint:recommended', 'plugin:mocha/recommended'), {
33-
plugins: {
34-
mocha,
35-
'@babel': babel,
36-
},
30+
languageOptions: {
31+
globals: {
32+
...globals.browser,
33+
...globals.node,
34+
...globals.jquery,
35+
...globals.amd,
36+
...globals.mocha,
37+
__base: false,
38+
expect: false,
39+
},
3740

38-
languageOptions: {
39-
globals: {
40-
...globals.browser,
41-
...globals.node,
42-
...globals.jquery,
43-
...globals.amd,
44-
...globals.mocha,
45-
__base: false,
46-
expect: false,
47-
},
41+
parser: babelParser,
42+
ecmaVersion: 6,
43+
sourceType: 'module',
4844

49-
parser: babelParser,
50-
ecmaVersion: 6,
51-
sourceType: 'module',
45+
parserOptions: {
46+
requireConfigFile: false,
47+
},
48+
},
5249

53-
parserOptions: {
54-
requireConfigFile: false,
55-
},
56-
},
50+
rules: {
51+
curly: 2,
52+
eqeqeq: ['error', 'smart'],
53+
quotes: [2, 'single', 'avoid-escape'],
54+
semi: 2,
5755

58-
rules: {
59-
curly: 2,
60-
eqeqeq: ['error', 'smart'],
61-
quotes: [2, 'single', 'avoid-escape'],
62-
semi: 2,
56+
'no-unused-vars': [
57+
'error',
58+
{
59+
caughtErrors: 'none',
60+
varsIgnorePattern: 'should|expect',
61+
},
62+
],
6363

64-
'no-unused-vars': ['error', {
65-
caughtErrors: 'none',
66-
varsIgnorePattern: 'should|expect',
67-
}],
68-
69-
'mocha/no-mocha-arrows': 0,
70-
},
71-
}];
64+
'mocha/no-mocha-arrows': 0,
65+
},
66+
},
67+
];

test/setup.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ String.prototype.truncate = function (limit) {
99
return this.length > limit ? this.substring(0, limit) + '…' : this;
1010
};
1111

12+
// eslint-disable-next-line mocha/no-top-level-hooks
1213
beforeEach(() => {
1314
linkify.reset();
1415
});

test/spec/linkify-plugin-ip.test.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ describe('linkify-plugin-ip', () => {
104104
// 'http://[f::ff:ff::f]', // too many colons, ambiguous (hard to implement)
105105
];
106106

107-
for (const test of validTests) {
108-
it(`Detects ${test[0]} as ${test[1]}`, () => {
109-
expect(linkify.test(test[0], test[1])).to.be.ok;
107+
for (const [value, type] of validTests) {
108+
it(`Detects ${value} as ${type}`, () => {
109+
expect(linkify.test(value, type)).to.be.ok;
110110
});
111111
}
112112

0 commit comments

Comments
 (0)