Skip to content

Commit e1dadca

Browse files
authored
Merge pull request #6420 from SuperGoodSoft/fix-linting
Fix linting
2 parents 6477ee8 + 398c020 commit e1dadca

13 files changed

Lines changed: 199 additions & 146 deletions

File tree

.eslintrc.json

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

.github/workflows/lint.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ env:
1515
jobs:
1616
ruby:
1717
name: Check Ruby
18-
runs-on: ubuntu-22.04
18+
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222
- name: Install Ruby and gems
2323
uses: ruby/setup-ruby@v1
2424
with:
25-
ruby-version: "3.2"
25+
ruby-version: "3.4"
2626
bundler-cache: true
2727
- name: Lint Ruby files
2828
run: bin/rake lint:rb
@@ -34,29 +34,31 @@ jobs:
3434

3535
erb:
3636
name: Check ERB
37-
runs-on: ubuntu-22.04
37+
runs-on: ubuntu-latest
3838
steps:
3939
- name: Checkout code
40-
uses: actions/checkout@v3
40+
uses: actions/checkout@v4
4141
- name: Install Ruby and gems
4242
uses: ruby/setup-ruby@v1
4343
with:
44-
ruby-version: "3.2"
44+
ruby-version: "3.4"
4545
bundler-cache: true
4646
- name: Lint ERB files
4747
run: bin/rake lint:erb
4848

4949
javascript:
5050
name: Check JavaScript
51-
runs-on: ubuntu-22.04
51+
runs-on: ubuntu-latest
5252
env:
5353
ESLINT_USE_FLAT_CONFIG: false
5454
steps:
55-
- uses: actions/checkout@v3
55+
- uses: actions/checkout@v4
5656
- name: Install Ruby and gems
5757
uses: ruby/setup-ruby@v1
5858
with:
59-
ruby-version: "3.2"
59+
ruby-version: "3.4"
6060
bundler-cache: true
61+
- name: Install ESLint globally
62+
run: npm install --save-dev eslint@latest @eslint/js@latest @eslint/eslintrc@latest
6163
- name: Lint JS files
6264
run: bin/rake lint:js

admin/.eslintrc.json

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

admin/eslint.config.mjs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { defineConfig } from "eslint/config";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import js from "@eslint/js";
5+
import { FlatCompat } from "@eslint/eslintrc";
6+
import rootConfig from "../eslint.config.mjs";
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all
14+
});
15+
16+
export default defineConfig([
17+
{
18+
extends: [compat.extends("eslint:recommended"), rootConfig],
19+
20+
languageOptions: {
21+
ecmaVersion: 2023,
22+
sourceType: "module",
23+
},
24+
}
25+
]);

api/spec/requests/spree/api/option_types_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def check_option_values(option_values)
9595
name: "Option Type",
9696
presentation: "Option Type",
9797
option_values_attributes: [
98-
name: "foo", presentation: "Foo"
98+
{ name: "foo", presentation: "Foo" }
9999
]
100100
}
101101
}

backend/app/assets/javascripts/spree/backend/components/tabs.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Tabs = (function() {
3030

3131
Tabs.prototype.overflowTabs = function() {
3232
var containerWidth = this.el.offsetWidth;
33-
var dropdownWidth = this.dropdown.offsetWidth;
3433

3534
for (var i = 0; i < this.tabs.length; i++) {
3635
var tab = this.tabs[i];
@@ -41,7 +40,6 @@ Tabs = (function() {
4140
this.el.classList.remove("tabs-overflowed");
4241
} else {
4342
this.el.classList.add("tabs-overflowed");
44-
remainingWidth -= dropdownWidth;
4543
}
4644

4745
var remainingWidth = containerWidth;

backend/app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Spree.Views.Tables.SelectableTable.SumReturnItemAmount = Backbone.View.extend({
1616

1717
totalSelectedReturnItemAmount: function () {
1818
var totalAmount = 0;
19-
var selectedItems = [];
19+
var selectedItems;
2020
var decimals = 0;
2121
var separator = Spree.t('currency_separator');
2222
var amount, decimalAmount;

core/app/helpers/spree/core/controller_helpers/strong_parameters.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ def permitted_attributes
1414

1515
def permitted_credit_card_update_attributes
1616
permitted_attributes.credit_card_update_attributes + [
17-
address_attributes: permitted_address_attributes
17+
{ address_attributes: permitted_address_attributes }
1818
]
1919
end
2020

2121
def permitted_payment_attributes
2222
permitted_attributes.payment_attributes + [
23-
source_attributes: permitted_source_attributes
23+
{ source_attributes: permitted_source_attributes }
2424
]
2525
end
2626

2727
def permitted_source_attributes
2828
permitted_attributes.source_attributes + [
29-
address_attributes: permitted_address_attributes
29+
{ address_attributes: permitted_address_attributes }
3030
]
3131
end
3232

@@ -52,20 +52,20 @@ def permitted_order_attributes
5252
permitted_checkout_payment_attributes +
5353
permitted_attributes.customer_metadata_attributes +
5454
permitted_checkout_confirm_attributes + [
55-
line_items_attributes: permitted_line_item_attributes
55+
{ line_items_attributes: permitted_line_item_attributes }
5656
]
5757
end
5858

5959
def permitted_product_attributes
6060
permitted_attributes.product_attributes + [
61-
product_properties_attributes: permitted_product_properties_attributes
61+
{ product_properties_attributes: permitted_product_properties_attributes }
6262
]
6363
end
6464

6565
def permitted_user_attributes
6666
permitted_attributes.user_attributes + [
67-
bill_address_attributes: permitted_address_attributes,
68-
ship_address_attributes: permitted_address_attributes
67+
{ bill_address_attributes: permitted_address_attributes,
68+
ship_address_attributes: permitted_address_attributes }
6969
]
7070
end
7171
end

core/app/models/spree/user_address.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ class UserAddress < Spree::Base
2525
all
2626
}
2727

28-
default_scope -> { order([default: :desc, updated_at: :desc]) }
28+
default_scope -> { order([{ default: :desc, updated_at: :desc }]) }
2929
end
3030
end

core/db/migrate/20180322142651_add_amount_remaining_to_store_credit_events.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ def up
3030

3131
credit.store_credit_events.chronological.each do |event|
3232
case event.action
33-
when StoreCredit::ALLOCATION_ACTION,
34-
StoreCredit::ELIGIBLE_ACTION,
35-
StoreCredit::CAPTURE_ACTION
36-
# These actions do not change the amount_remaining so the previous
37-
# amount available is used (either the credit's amount or the
38-
# amount_remaining coming from the event right before this one).
39-
credit_amount
4033
when StoreCredit::AUTHORIZE_ACTION,
4134
StoreCredit::INVALIDATE_ACTION
4235
# These actions remove the amount from the available credit amount.

0 commit comments

Comments
 (0)