Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the latest version of our eslint-plugin #454

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
module.exports = {
root: true,
extends: ["plugin:@foretagsplatsen/eslint-plugin-ftgp/main", "plugin:import/recommended"],
extends: ["plugin:@foretagsplatsen/main"],
parserOptions: {
ecmaVersion: 6,
sourceType: "module"
},
rules: {
"no-console": ["error"],
"quotes": ["error", "double"],
"ftgp/require-class-comment": 0,
"import/no-absolute-path": "error",
"import/no-self-import": "error",
"import/no-useless-path-segments": "error",
"import/no-cycle": "error",
"import/no-unused-modules": [
"error",
{
unusedExports: true,
missingExports: true,
ignoreExports: [
// List of files exporting stuff which are not imported:
"src/widgetjs.js",
// List of files not exporting anything:
"**/.eslintrc.js",
"webpack*",
"src/router/optionalParameterSegment.js",
"src/router/staticSegment.js"
],
},
]
}
};
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@
"test": "jasmine-browser-runner runSpecs --config=jasmine-browser.json"
},
"devDependencies": {
"@foretagsplatsen/eslint-plugin-ftgp": "^2.1.1",
"@foretagsplatsen/eslint-plugin": "^3.0.0",
"eslint": "^8.55.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-node": "^11.1.0",
"jasmine": "^5.1.0",
"jasmine-browser-runner": "^2.3.0",
"jasmine-reporters": "^2.5.2",
Expand Down
8 changes: 4 additions & 4 deletions src/Widget2.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import router from "./router";
import router from "./router.js";
import {eventCategory} from "yaem";
import htmlCanvas from "./htmlCanvas";
import htmlCanvas from "./htmlCanvas.js";
import jQuery from "jquery";
import {getCurrentWidget, withCurrentWidget} from "./currentWidget";
import {newId} from "./idGenerator";
import {getCurrentWidget, withCurrentWidget} from "./currentWidget.js";
import {newId} from "./idGenerator.js";

/**
* Base for all widgets. A widget can keep state in variables, contain logic and
Expand Down
2 changes: 1 addition & 1 deletion src/currentWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function getCurrentWidget() {
return currentWidget;
}

export function setCurrentWidget(widget) {
function setCurrentWidget(widget) {
currentWidget = widget;
}

Expand Down
6 changes: 3 additions & 3 deletions src/router.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import url from "./router/url";
import route from "./router/route";
import router from "./router/router";
import url from "./router/url.js";
import route from "./router/route.js";
import router from "./router/router.js";

var routerSingleton = router();

Expand Down
2 changes: 1 addition & 1 deletion src/router/abstractSegment.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { object } from "klassified";
* @param my
* @returns {abstractSegment}
*/
var abstractSegment = object.subclass(function(that, my) {
const abstractSegment = object.subclass(function(that, my) {

my.initialize = function(spec) {
my.super(spec);
Expand Down
4 changes: 2 additions & 2 deletions src/router/hashLocation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import jQuery from "jquery";
import {eventCategory} from "yaem";
import url from "./url";
import url from "./url.js";
import { object } from "klassified";

/**
Expand Down Expand Up @@ -30,7 +30,7 @@ var pollInterval = 25;
* @param [my]
* @returns {hashLocation}
*/
var hashLocation = object.subclass(function(that, my) {
const hashLocation = object.subclass(function(that, my) {

var pollTimerId = null;

Expand Down
6 changes: 2 additions & 4 deletions src/router/optionalParameterSegment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import parameterSegment from "./parameterSegment";
import parameterSegment from "./parameterSegment.js";

/**
* Optional parameters can have a default value.
Expand All @@ -7,7 +7,7 @@ import parameterSegment from "./parameterSegment";
* @param my
* @returns {parameter}
*/
var optionalParameterSegment = parameterSegment.subclass(function(that, my) {
const optionalParameterSegment = parameterSegment.subclass(function(that, my) {

my.initialize = function(spec) {
my.super(spec);
Expand Down Expand Up @@ -57,5 +57,3 @@ optionalParameterSegment.class(function(that) {
return segmentString.substr(0, 1) === "?";
};
});

export default optionalParameterSegment;
4 changes: 2 additions & 2 deletions src/router/parameterSegment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import abstractSegment from "./abstractSegment";
import abstractSegment from "./abstractSegment.js";

/**
* Constructs validator functions from constraints parameters.
Expand Down Expand Up @@ -40,7 +40,7 @@ function parameterValidator(constraint) {
* @param [my]
* @returns {parameterSegment}
*/
var parameterSegment = abstractSegment.subclass(function(that, my) {
const parameterSegment = abstractSegment.subclass(function(that, my) {

my.initialize = function(spec) {
my.super(spec);
Expand Down
8 changes: 4 additions & 4 deletions src/router/route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import routeFactory from "./routeFactory";
import routeFactory from "./routeFactory.js";
import {eventCategory} from "yaem";
import routeMatchResult from "./routeMatchResult";
import url from "./url";
import routeMatchResult from "./routeMatchResult.js";
import url from "./url.js";
import { object } from "klassified";
import "jquery";

Expand Down Expand Up @@ -56,7 +56,7 @@ import "jquery";
* @param {{}} my
* @returns {route}
*/
var route = object.subclass(function(that, my) {
const route = object.subclass(function(that, my) {

var segments;
var ignoreTrailingSegments;
Expand Down
8 changes: 4 additions & 4 deletions src/router/routeFactory.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import abstractSegment from "./abstractSegment";
import "./parameterSegment";
import "./optionalParameterSegment";
import "./staticSegment";
import abstractSegment from "./abstractSegment.js";
import "./parameterSegment.js";
import "./optionalParameterSegment.js";
import "./staticSegment.js";

/**
* Token/Char used to separate segments in route patterns.
Expand Down
2 changes: 1 addition & 1 deletion src/router/routeMatchResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { object } from "klassified";
*
* @returns {routeMatchResult}
*/
var routeMatchResult = object.subclass(function(that, my) {
const routeMatchResult = object.subclass(function(that, my) {

var url;
var route;
Expand Down
8 changes: 4 additions & 4 deletions src/router/router.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {eventCategory} from "yaem";
import route from "./route";
import url from "./url";
import hashLocation from "./hashLocation";
import route from "./route.js";
import url from "./url.js";
import hashLocation from "./hashLocation.js";
import { object } from "klassified";
import "jquery";

Expand Down Expand Up @@ -33,7 +33,7 @@ function hashSingleton() {
*
* @returns {{}}
*/
var router = object.subclass(function(that, my) {
const router = object.subclass(function(that, my) {

my.initialize = function(spec) {
my.super(spec);
Expand Down
6 changes: 2 additions & 4 deletions src/router/staticSegment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import abstractSegment from "./abstractSegment";
import abstractSegment from "./abstractSegment.js";

/**
* A static segment match URL segments that are identical
Expand All @@ -8,7 +8,7 @@ import abstractSegment from "./abstractSegment";
* @param [my]
* @returns {segment}
*/
var staticSegment = abstractSegment.subclass(function(that, my) {
const staticSegment = abstractSegment.subclass(function(that, my) {

/**
* Static segment match if URL and route segment
Expand All @@ -35,5 +35,3 @@ staticSegment.class(function(that) {
return ["#", "?"].indexOf(segmentString[0]) === -1;
};
});

export default staticSegment;
2 changes: 1 addition & 1 deletion src/router/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var urlSeparator = "/";
* @param {string} rawUrl
* @returns {url}
*/
var url = object.subclass(function(that, my) {
const url = object.subclass(function(that, my) {

var rawUrl;
var path;
Expand Down
5 changes: 5 additions & 0 deletions src/test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
rules: {
"import/no-unused-modules": "off"
}
};
2 changes: 1 addition & 1 deletion src/test/htmlCanvasTest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import htmlCanvas from "../htmlCanvas";
import htmlCanvas from "../htmlCanvas.js";
import jQuery from "jquery";

function withCanvas(callback) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/router/hashLocationTest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import jQuery from "jquery";
import hashLocationModel from "../../router/hashLocation";
import hashLocationModel from "../../router/hashLocation.js";

// Helpers

Expand Down
2 changes: 1 addition & 1 deletion src/test/router/routeTest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import router from "../../router";
import router from "../../router.js";

function assertMatch(url, route, message) {
expect(router.url({rawUrl: url}).matchRoute(router.route({ pattern: route })).isMatch()).toBeTruthy();
Expand Down
2 changes: 1 addition & 1 deletion src/test/router/routerTest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import router from "../../router/router";
import router from "../../router/router.js";

function delayedSteps() {
var steps = Array.prototype.slice.call(arguments);
Expand Down
10 changes: 5 additions & 5 deletions src/test/tests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "./htmlCanvasTest";
import "./widgetTest";
import "./router/hashLocationTest";
import "./router/routerTest";
import "./router/routeTest";
import "./htmlCanvasTest.js";
import "./widgetTest.js";
import "./router/hashLocationTest.js";
import "./router/routerTest.js";
import "./router/routeTest.js";
4 changes: 2 additions & 2 deletions src/test/widgetTest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import widget from "../widget";
import htmlCanvas from "../htmlCanvas";
import widget from "../widget.js";
import htmlCanvas from "../htmlCanvas.js";
import jQuery from "jquery";

var widgetSubclass = widget.subclass(function(that, my) {
Expand Down
12 changes: 6 additions & 6 deletions src/widget.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { object } from "klassified";
import widgetExtensions from "./widget-extensions";
import router from "./router";
import widgetExtensions from "./widget-extensions.js";
import router from "./router.js";
import {eventCategory} from "yaem";
import htmlCanvas from "./htmlCanvas";
import htmlCanvas from "./htmlCanvas.js";
import jQuery from "jquery";
import {getCurrentWidget, withCurrentWidget} from "./currentWidget";
import {newId} from "./idGenerator";
import {getCurrentWidget, withCurrentWidget} from "./currentWidget.js";
import {newId} from "./idGenerator.js";

/**
* Base for all widgets. A widget can keep state in variables, contain logic and
Expand Down Expand Up @@ -46,7 +46,7 @@ import {newId} from "./idGenerator";
*
* @returns {widget}
*/
var widget = object.subclass(function(that, my) {
const widget = object.subclass(function(that, my) {

/**
* Keep track of the rendered subwidgets
Expand Down
10 changes: 5 additions & 5 deletions src/widgetjs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export {default as htmlCanvas} from "./htmlCanvas";
export {default as widget} from "./widget";
export {default as Widget} from "./Widget2";
export {default as ext} from "./widget-extensions";
export {default as router} from "./router";
export {default as htmlCanvas} from "./htmlCanvas.js";
export {default as widget} from "./widget.js";
export {default as Widget} from "./Widget2.js";
export {default as ext} from "./widget-extensions.js";
export {default as router} from "./router.js";
Loading