Skip to content

Commit 231709f

Browse files
authored
fix: eslint doesnt work (#4379)
1 parent 1af834d commit 231709f

File tree

11 files changed

+104
-99
lines changed

11 files changed

+104
-99
lines changed

.eslintignore

-2
This file was deleted.

.eslintrc.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module.exports = {
2+
extends: 'airbnb-base',
3+
env: {
4+
node: true,
5+
},
6+
parserOptions: {
7+
ecmaVersion: 2020,
8+
},
9+
rules: {
10+
'func-names': 0,
11+
'no-use-before-define': 0,
12+
'no-unused-vars': 0,
13+
'no-underscore-dangle': 0,
14+
'no-undef': 0,
15+
'prefer-destructuring': 0,
16+
'no-param-reassign': 0,
17+
'max-len': 0,
18+
camelcase: 0,
19+
'no-shadow': 0,
20+
'consistent-return': 0,
21+
'no-console': 0,
22+
'global-require': 0,
23+
'class-methods-use-this': 0,
24+
'no-plusplus': 0,
25+
'no-return-assign': 0,
26+
'prefer-rest-params': 0,
27+
'no-useless-escape': 0,
28+
'no-restricted-syntax': 0,
29+
'no-unused-expressions': 0,
30+
'guard-for-in': 0,
31+
'no-multi-assign': 0,
32+
'require-yield': 0,
33+
'prefer-spread': 0,
34+
'import/no-dynamic-require': 0,
35+
'no-continue': 0,
36+
'no-mixed-operators': 0,
37+
'default-case': 0,
38+
'import/no-extraneous-dependencies': 0,
39+
'no-cond-assign': 0,
40+
'import/no-unresolved': 0,
41+
'no-await-in-loop': 0,
42+
'arrow-body-style': 0,
43+
'no-loop-func': 0,
44+
'arrow-parens': 0,
45+
'default-param-last': 0,
46+
},
47+
ignorePatterns: ['test/data/output', 'lib/css2xpath/*'],
48+
};

.eslintrc.json

-47
This file was deleted.

.github/dependabot.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ updates:
1717
versions: [">=5.0"]
1818
- dependency-name: "apollo-server-express"
1919
versions: [">=3.0"]
20-
20+
- dependency-name: "eslint"
21+
versions: [ ">8.57.0" ]
22+

.hound.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
eslint:
22
enabled: true
3-
config_file: .eslintrc.json
3+
config_file: .eslintrc.js

lib/command/gherkin/init.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = function (genPath) {
3030

3131
if (!configFile) {
3232
output.error(
33-
"Can't initialize Gherkin. This command must be run in an already initialized project."
33+
"Can't initialize Gherkin. This command must be run in an already initialized project.",
3434
);
3535
process.exit(1);
3636
}
@@ -65,12 +65,12 @@ module.exports = function (genPath) {
6565

6666
if (safeFileWrite(path.join(dir, `steps.${extension}`), stepsFile)) {
6767
output.success(
68-
`Created sample steps file: step_definitions/steps.${extension}`
68+
`Created sample steps file: step_definitions/steps.${extension}`,
6969
);
7070
}
7171

7272
config.gherkin = {
73-
features: "./features/*.feature",
73+
features: './features/*.feature',
7474
steps: [`./step_definitions/steps.${extension}`],
7575
};
7676

lib/command/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function updateConfig(testsPath, config, extension) {
4747
const msg = `codecept.conf.${extension} config can\'t be updated automatically`;
4848
console.log();
4949
console.log(`${output.colors.bold.red(msg)}`);
50-
console.log(`${output.colors.bold.red("Please update it manually:")}`);
50+
console.log(`${output.colors.bold.red('Please update it manually:')}`);
5151
console.log();
5252
console.log(config);
5353
console.log();
@@ -114,4 +114,4 @@ module.exports.findConfigFile = (testsPath) => {
114114
}
115115
}
116116
return null;
117-
}
117+
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"contributor-faces": "1.1.0",
137137
"documentation": "12.3.0",
138138
"electron": "30.0.3",
139-
"eslint": "9.2.0",
139+
"eslint": "8.57.0",
140140
"eslint-config-airbnb-base": "15.0.0",
141141
"eslint-plugin-import": "2.29.1",
142142
"eslint-plugin-mocha": "10.4.3",
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/** @type {CodeceptJS.MainConfig} */
22
exports.config = {
3-
tests: "./*_test.js",
4-
output: "./output",
3+
tests: './*_test.js',
4+
output: './output',
55
helpers: {
66
Playwright: {
7-
browser: "chromium",
8-
url: "http://localhost",
7+
browser: 'chromium',
8+
url: 'http://localhost',
99
show: true,
1010
},
1111
},
1212
include: {
13-
I: "./steps_file.js",
13+
I: './steps_file.js',
1414
},
15-
name: "CodeceptJS",
15+
name: 'CodeceptJS',
1616
};

test/plugin/plugin_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('CodeceptJS plugin', function () {
3939
expect.arrayContaining([
4040
expect.stringContaining('writing output/coverage'),
4141
expect.stringContaining('generated coverage reports:'),
42-
expect.stringContaining('output/coverage/index.html')
42+
expect.stringContaining('output/coverage/index.html'),
4343
]),
4444
);
4545
expect(err).toBeFalsy();
@@ -54,7 +54,7 @@ describe('CodeceptJS plugin', function () {
5454
expect.arrayContaining([
5555
expect.stringContaining('writing output/coverage'),
5656
expect.stringContaining('generated coverage reports:'),
57-
expect.stringContaining('output/coverage/index.html')
57+
expect.stringContaining('output/coverage/index.html'),
5858
]),
5959
);
6060
expect(err).toBeFalsy();

test/runner/gherkin_test.js

+38-34
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,93 @@
1-
const assert = require("assert");
2-
const path = require("path");
3-
const fs = require("fs");
4-
const exec = require("child_process").exec;
1+
const assert = require('assert');
2+
const path = require('path');
3+
const fs = require('fs');
4+
const exec = require('child_process').exec;
55

6-
const runner = path.join(__dirname, "/../../bin/codecept.js");
7-
const codecept_dir = path.join(__dirname, "/../data/sandbox/configs/gherkin/");
6+
const runner = path.join(__dirname, '/../../bin/codecept.js');
7+
const codecept_dir = path.join(__dirname, '/../data/sandbox/configs/gherkin/');
88

9-
describe("gherkin bdd commands", () => {
10-
describe("bdd:init", () => {
11-
let codecept_dir_js = path.join(codecept_dir, "config_js");
12-
let codecept_dir_ts = path.join(codecept_dir, "config_ts");
9+
describe('gherkin bdd commands', () => {
10+
describe('bdd:init', () => {
11+
const codecept_dir_js = path.join(codecept_dir, 'config_js');
12+
const codecept_dir_ts = path.join(codecept_dir, 'config_ts');
1313

1414
beforeEach(() => {
1515
fs.copyFileSync(
16-
path.join(codecept_dir_js, "codecept.conf.init.js"),
17-
path.join(codecept_dir_js, "codecept.conf.js")
16+
path.join(codecept_dir_js, 'codecept.conf.init.js'),
17+
path.join(codecept_dir_js, 'codecept.conf.js'),
1818
);
1919
fs.copyFileSync(
20-
path.join(codecept_dir_ts, "codecept.conf.init.ts"),
21-
path.join(codecept_dir_ts, "codecept.conf.ts")
20+
path.join(codecept_dir_ts, 'codecept.conf.init.ts'),
21+
path.join(codecept_dir_ts, 'codecept.conf.ts'),
2222
);
2323
});
2424

2525
afterEach(() => {
2626
try {
27-
fs.rmSync(path.join(codecept_dir_js, "codecept.conf.js"));
28-
fs.rmSync(path.join(codecept_dir_js, "features"), {
27+
fs.rmSync(path.join(codecept_dir_js, 'codecept.conf.js'));
28+
fs.rmSync(path.join(codecept_dir_js, 'features'), {
2929
recursive: true,
3030
});
31-
fs.rmSync(path.join(codecept_dir_js, "step_definitions"), {
31+
fs.rmSync(path.join(codecept_dir_js, 'step_definitions'), {
3232
recursive: true,
3333
});
34-
} catch (e) {}
34+
} catch (e) {
35+
// catch some error
36+
}
3537
try {
36-
fs.rmSync(path.join(codecept_dir_ts, "codecept.conf.ts"));
37-
fs.rmSync(path.join(codecept_dir_ts, "features"), {
38+
fs.rmSync(path.join(codecept_dir_ts, 'codecept.conf.ts'));
39+
fs.rmSync(path.join(codecept_dir_ts, 'features'), {
3840
recursive: true,
3941
});
40-
fs.rmSync(path.join(codecept_dir_ts, "step_definitions"), {
42+
fs.rmSync(path.join(codecept_dir_ts, 'step_definitions'), {
4143
recursive: true,
4244
});
43-
} catch (e) {}
45+
} catch (e) {
46+
// catch some error
47+
}
4448
});
4549

4650
[
4751
{
4852
codecept_dir_test: codecept_dir_js,
49-
extension: "js",
53+
extension: 'js',
5054
},
5155
{
5256
codecept_dir_test: codecept_dir_ts,
53-
extension: "ts",
57+
extension: 'ts',
5458
},
5559
].forEach(({ codecept_dir_test, extension }) => {
5660
it(`prepare CodeceptJS to run feature files (codecept.conf.${extension})`, (done) => {
5761
exec(`${runner} gherkin:init ${codecept_dir_test}`, (err, stdout) => {
58-
let dir = path.join(codecept_dir_test, "features");
62+
let dir = path.join(codecept_dir_test, 'features');
5963

6064
stdout.should.include(
61-
"Initializing Gherkin (Cucumber BDD) for CodeceptJS"
65+
'Initializing Gherkin (Cucumber BDD) for CodeceptJS',
6266
);
6367
stdout.should.include(
64-
`Created ${dir}, place your *.feature files in it`
68+
`Created ${dir}, place your *.feature files in it`,
6569
);
6670
stdout.should.include(
67-
"Created sample feature file: features/basic.feature"
71+
'Created sample feature file: features/basic.feature',
6872
);
6973

70-
dir = path.join(codecept_dir_test, "step_definitions");
74+
dir = path.join(codecept_dir_test, 'step_definitions');
7175
stdout.should.include(
72-
`Created ${dir}, place step definitions into it`
76+
`Created ${dir}, place step definitions into it`,
7377
);
7478
stdout.should.include(
75-
`Created sample steps file: step_definitions/steps.${extension}`
79+
`Created sample steps file: step_definitions/steps.${extension}`,
7680
);
7781
assert(!err);
7882

7983
const configResult = fs
8084
.readFileSync(
81-
path.join(codecept_dir_test, `codecept.conf.${extension}`)
85+
path.join(codecept_dir_test, `codecept.conf.${extension}`),
8286
)
8387
.toString();
84-
configResult.should.contain(`features: './features/*.feature'`);
88+
configResult.should.contain('features: \'./features/*.feature\'');
8589
configResult.should.contain(
86-
`steps: ['./step_definitions/steps.${extension}']`
90+
`steps: ['./step_definitions/steps.${extension}']`,
8791
);
8892
done();
8993
});

0 commit comments

Comments
 (0)