Skip to content

Commit

Permalink
remove .editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
tianfeng92 committed Nov 28, 2024
1 parent de71a55 commit be8c712
Show file tree
Hide file tree
Showing 14 changed files with 413 additions and 403 deletions.
15 changes: 0 additions & 15 deletions .editorconfig

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ jobs:

- name: Test
run: npm test

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
lib/
node_modules
screenshots/
screenshots/
8 changes: 4 additions & 4 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hooks": {
"before:init": ["npm test"],
"after:bump": "npm run build"
}
"hooks": {
"before:init": ["npm test"],
"after:bump": "npm run build"
}
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
- Fixed issue #1 - an invalid function call when no platform was specified

## [0.0.1] - 2017-01-24
- Initial release
- Initial release
18 changes: 9 additions & 9 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ const gulp = require("gulp");
const mocha = require("gulp-mocha");

function clean() {
return del(["lib"]);
return del(["lib"]);
}

function build() {
return gulp.src("src/**/*.js").pipe(babel()).pipe(gulp.dest("lib"));
return gulp.src("src/**/*.js").pipe(babel()).pipe(gulp.dest("lib"));
}

function test() {
return gulp.src("test/**.js").pipe(
mocha({
ui: "bdd",
reporter: "spec",
timeout: typeof v8debug === "undefined" ? 2000 : Infinity, // NOTE: disable timeouts in debug
}),
);
return gulp.src("test/**.js").pipe(
mocha({
ui: "bdd",
reporter: "spec",
timeout: typeof v8debug === "undefined" ? 2000 : Infinity, // NOTE: disable timeouts in debug
}),
);
}

exports.clean = clean;
Expand Down
60 changes: 30 additions & 30 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@ import prettier from "eslint-config-prettier";
import mocha from "eslint-plugin-mocha";

export default [
{
files: ["src/**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
...prettier.rules,
...js.configs.recommended.rules,
},
{
files: ["src/**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
{
files: ["test/**/*.js"],
plugins: {
mocha,
},
rules: {
...mocha.configs.recommended.rules,
"mocha/no-exclusive-tests": "error",
"mocha/no-skipped-tests": "warn",
},
rules: {
...prettier.rules,
...js.configs.recommended.rules,
},
{
languageOptions: {
globals: {
__dirname: true,
console: true,
exports: true,
module: true,
require: true,
},
},
},
{
files: ["test/**/*.js"],
plugins: {
mocha,
},
rules: {
...mocha.configs.recommended.rules,
"mocha/no-exclusive-tests": "error",
"mocha/no-skipped-tests": "warn",
},
},
{
languageOptions: {
globals: {
__dirname: true,
console: true,
exports: true,
module: true,
require: true,
},
},
},
];
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"devDependencies": {
"@eslint/js": "^9.15.0",
"@types/eslint-plugin-mocha": "^10.4.0",
"babel-eslint": "^6.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-runtime": "^6.12.0",
Expand Down
70 changes: 32 additions & 38 deletions src/device_list.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,40 @@
export default {
find(list, { platform, name }) {
// Do a lowercase match on the device they have asked for so we can be nice about iphone vs iPhone
platform = platform.toLowerCase();
name = name.toLowerCase();
find(list, { platform, name }) {
// Do a lowercase match on the device they have asked for so we can be nice about iphone vs iPhone
platform = platform.toLowerCase();
name = name.toLowerCase();

const device = list.find((d) => {
return (
(platform === "any" ||
platform === `${d.os} ${d.version}`.toLowerCase()) &&
name === d.name.toLowerCase()
);
});
const device = list.find((d) => {
return (
(platform === "any" ||
platform === `${d.os} ${d.version}`.toLowerCase()) &&
name === d.name.toLowerCase()
);
});

if (typeof device === "undefined") return null;
return device;
},
if (typeof device === "undefined") return null;
return device;
},

parse(rawList) {
const parsedList = [];
parse(rawList) {
const parsedList = [];

for (const entry of rawList) {
try {
var {
udid,
os_version: osVersion,
state,
name,
} = JSON.parse(entry);
// eslint-disable-next-line no-unused-vars
} catch (e) {
continue;
}
const [os, version] = osVersion.split(" ");
const device = { name, os, version, udid, state };
for (const entry of rawList) {
try {
var { udid, os_version: osVersion, state, name } = JSON.parse(entry);
// eslint-disable-next-line no-unused-vars
} catch (e) {
continue;
}
const [os, version] = osVersion.split(" ");
const device = { name, os, version, udid, state };

// We can't run tests on tvOS or watchOS, so only include iOS devices
if (device.os && device.os.startsWith("iOS"))
parsedList.push(device);
}
// We can't run tests on tvOS or watchOS, so only include iOS devices
if (device.os && device.os.startsWith("iOS")) parsedList.push(device);
}

return parsedList.sort((a, b) => {
return parseFloat(b.version) - parseFloat(a.version);
});
},
return parsedList.sort((a, b) => {
return parseFloat(b.version) - parseFloat(a.version);
});
},
};
Loading

0 comments on commit be8c712

Please sign in to comment.