From 4f3f46d1be625ed626ba9768e09cc39f698c82de Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Fri, 5 Jul 2024 15:14:24 +0800 Subject: [PATCH] fixed linter --- .eslintrc.js | 5 +- .stylelintrc.js | 2 +- addon/components/admin/product-category.js | 2 +- addon/components/cell/product-info.js | 2 +- addon/components/sales-order-form-panel.js | 1 - addon/components/warehouse-form-panel.js | 3 +- addon/controllers/inventory/expired-stock.js | 7 -- addon/controllers/inventory/index.js | 7 -- .../inventory/index/new-stock-adjustment.js | 2 +- addon/controllers/inventory/low-stock.js | 7 -- addon/models/warehouse-aisle.js | 5 +- addon/models/warehouse-bin.js | 2 +- addon/models/warehouse-dock.js | 2 +- addon/models/warehouse-rack.js | 2 +- tests/dummy/config/ember-try.js | 94 +++++++++---------- tests/dummy/config/environment.js | 24 ++--- 16 files changed, 75 insertions(+), 92 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2eba0f1e..69bae165 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,6 +16,9 @@ module.exports = { env: { browser: true, }, + globals: { + Stripe: 'readonly', + }, rules: { 'ember/no-array-prototype-extensions': 'off', 'ember/no-computed-properties-in-native-classes': 'off', @@ -24,7 +27,7 @@ module.exports = { 'ember/no-get': 'off', 'ember/classic-decorator-no-classic-methods': 'off', 'no-prototype-builtins': 'off', - 'node/no-unpublished-require': [ + 'n/no-unpublished-require': [ 'error', { allowModules: ['resolve', 'broccoli-funnel'], diff --git a/.stylelintrc.js b/.stylelintrc.js index 021c539a..62d45540 100644 --- a/.stylelintrc.js +++ b/.stylelintrc.js @@ -1,5 +1,5 @@ 'use strict'; module.exports = { - extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'], + extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'], }; diff --git a/addon/components/admin/product-category.js b/addon/components/admin/product-category.js index 27ec16de..d5581a48 100644 --- a/addon/components/admin/product-category.js +++ b/addon/components/admin/product-category.js @@ -6,7 +6,6 @@ import { dasherize } from '@ember/string'; export default class AdminProductCategoryComponent extends Component { @service store; - @service modalsManager; @service currentUser; @service modalsManager; @service notifications; @@ -90,6 +89,7 @@ export default class AdminProductCategoryComponent extends Component { declineButtonIconPrefix: 'fas', category: subCategory, uploadNewPhoto: (file) => { + const category = this.modalsManager.getOption('category'); this.fetch.uploadFile.perform( file, { diff --git a/addon/components/cell/product-info.js b/addon/components/cell/product-info.js index d593958b..24771abc 100644 --- a/addon/components/cell/product-info.js +++ b/addon/components/cell/product-info.js @@ -2,7 +2,7 @@ import Component from '@glimmer/component'; import { action, computed, get } from '@ember/object'; export default class CellProductInfoComponent extends Component { - @computed('args.row', 'args.column.modelPath') get product() { + @computed('args.{row,column.modelPath}') get product() { const { column, row } = this.args; if (typeof column?.modelPath === 'string') { diff --git a/addon/components/sales-order-form-panel.js b/addon/components/sales-order-form-panel.js index 25e7635c..0c8a6484 100644 --- a/addon/components/sales-order-form-panel.js +++ b/addon/components/sales-order-form-panel.js @@ -2,7 +2,6 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; -import { isValid as isValidDate } from 'date-fns'; import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; diff --git a/addon/components/warehouse-form-panel.js b/addon/components/warehouse-form-panel.js index b57c7625..cd220289 100644 --- a/addon/components/warehouse-form-panel.js +++ b/addon/components/warehouse-form-panel.js @@ -3,7 +3,6 @@ import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { isBlank } from '@ember/utils'; -import { all } from 'rsvp'; import Point from '@fleetbase/fleetops-data/utils/geojson/point'; import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback'; import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments'; @@ -94,7 +93,7 @@ export default class WarehouseFormPanelComponent extends Component { try { return warehouse .save() - .then((place) => { + .then((warehouse) => { this.notifications.success(`Warehouse (${warehouse.name}) saved successfully.`); contextComponentCallback(this, 'onAfterSave', warehouse); }) diff --git a/addon/controllers/inventory/expired-stock.js b/addon/controllers/inventory/expired-stock.js index a4136955..4fac5c2f 100644 --- a/addon/controllers/inventory/expired-stock.js +++ b/addon/controllers/inventory/expired-stock.js @@ -120,13 +120,6 @@ export default class InventoryExpiredStockController extends Controller { */ @tracked product; - /** - * The filterable param `status` - * - * @var {String} - */ - @tracked status; - /** * All columns applicable for orders * diff --git a/addon/controllers/inventory/index.js b/addon/controllers/inventory/index.js index 6f93ba48..306c7698 100644 --- a/addon/controllers/inventory/index.js +++ b/addon/controllers/inventory/index.js @@ -118,13 +118,6 @@ export default class InventoryIndexController extends Controller { */ @tracked product; - /** - * The filterable param `status` - * - * @var {String} - */ - @tracked status; - /** * All columns applicable for orders * diff --git a/addon/controllers/inventory/index/new-stock-adjustment.js b/addon/controllers/inventory/index/new-stock-adjustment.js index f356b7b9..00c01128 100644 --- a/addon/controllers/inventory/index/new-stock-adjustment.js +++ b/addon/controllers/inventory/index/new-stock-adjustment.js @@ -66,7 +66,7 @@ export default class InventoryIndexNewStockAdjustmentController extends Controll * @return {Promise} * @memberof InventoryIndexNewStockAdjustmentController */ - @action onAfterSave(stockAdjustment) { + @action onAfterSave() { if (this.overlay) { this.overlay.close(); } diff --git a/addon/controllers/inventory/low-stock.js b/addon/controllers/inventory/low-stock.js index 8409f7af..bd5a2d0a 100644 --- a/addon/controllers/inventory/low-stock.js +++ b/addon/controllers/inventory/low-stock.js @@ -106,13 +106,6 @@ export default class InventoryLowStockController extends Controller { */ @tracked batch; - /** - * The filterable param `status` - * - * @var {String|Array} - */ - @tracked status; - /** * The filterable param `pallet-product` * diff --git a/addon/models/warehouse-aisle.js b/addon/models/warehouse-aisle.js index c918a0c8..531e2627 100644 --- a/addon/models/warehouse-aisle.js +++ b/addon/models/warehouse-aisle.js @@ -1,6 +1,9 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; import { computed } from '@ember/object'; -import { format as formatDate, isValid as isValidDate } from 'date-fns'; +import { isArray } from '@ember/array'; +import { format as formatDate, isValid as isValidDate, formatDistanceToNow } from 'date-fns'; +import getWithDefault from '@fleetbase/ember-core/utils/get-with-default'; +import first from '@fleetbase/ember-core/utils/first'; export default class WarehouseAisle extends Model { /** @ids */ diff --git a/addon/models/warehouse-bin.js b/addon/models/warehouse-bin.js index 26a661ba..c19bc127 100644 --- a/addon/models/warehouse-bin.js +++ b/addon/models/warehouse-bin.js @@ -1,6 +1,6 @@ import Model, { attr, belongsTo } from '@ember-data/model'; import { computed } from '@ember/object'; -import { format as formatDate, isValid as isValidDate } from 'date-fns'; +import { format as formatDate, isValid as isValidDate, formatDistanceToNow } from 'date-fns'; export default class WarehouseBin extends Model { /** @ids */ diff --git a/addon/models/warehouse-dock.js b/addon/models/warehouse-dock.js index a8847394..50b04b20 100644 --- a/addon/models/warehouse-dock.js +++ b/addon/models/warehouse-dock.js @@ -1,6 +1,6 @@ import Model, { attr, belongsTo } from '@ember-data/model'; import { computed } from '@ember/object'; -import { format as formatDate, isValid as isValidDate } from 'date-fns'; +import { format as formatDate, isValid as isValidDate, formatDistanceToNow } from 'date-fns'; export default class WarehouseDock extends Model { /** @ids */ diff --git a/addon/models/warehouse-rack.js b/addon/models/warehouse-rack.js index 7970d65c..933cae7e 100644 --- a/addon/models/warehouse-rack.js +++ b/addon/models/warehouse-rack.js @@ -1,6 +1,6 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; import { computed } from '@ember/object'; -import { format as formatDate, isValid as isValidDate } from 'date-fns'; +import { format as formatDate, isValid as isValidDate, formatDistanceToNow } from 'date-fns'; export default class WarehouseRack extends Model { /** @ids */ diff --git a/tests/dummy/config/ember-try.js b/tests/dummy/config/ember-try.js index 283e42a4..eff5a62a 100644 --- a/tests/dummy/config/ember-try.js +++ b/tests/dummy/config/ember-try.js @@ -4,51 +4,51 @@ const getChannelURL = require('ember-source-channel-url'); const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup'); module.exports = async function () { - return { - useYarn: true, - scenarios: [ - { - name: 'ember-lts-4.8', - npm: { - devDependencies: { - 'ember-source': '~4.8.0', - }, - }, - }, - { - name: 'ember-lts-4.12', - npm: { - devDependencies: { - 'ember-source': '~4.12.0', - }, - }, - }, - { - name: 'ember-release', - npm: { - devDependencies: { - 'ember-source': await getChannelURL('release'), - }, - }, - }, - { - name: 'ember-beta', - npm: { - devDependencies: { - 'ember-source': await getChannelURL('beta'), - }, - }, - }, - { - name: 'ember-canary', - npm: { - devDependencies: { - 'ember-source': await getChannelURL('canary'), - }, - }, - }, - embroiderSafe(), - embroiderOptimized(), - ], - }; + return { + useYarn: true, + scenarios: [ + { + name: 'ember-lts-4.8', + npm: { + devDependencies: { + 'ember-source': '~4.8.0', + }, + }, + }, + { + name: 'ember-lts-4.12', + npm: { + devDependencies: { + 'ember-source': '~4.12.0', + }, + }, + }, + { + name: 'ember-release', + npm: { + devDependencies: { + 'ember-source': await getChannelURL('release'), + }, + }, + }, + { + name: 'ember-beta', + npm: { + devDependencies: { + 'ember-source': await getChannelURL('beta'), + }, + }, + }, + { + name: 'ember-canary', + npm: { + devDependencies: { + 'ember-source': await getChannelURL('canary'), + }, + }, + }, + embroiderSafe(), + embroiderOptimized(), + ], + }; }; diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 93f026b2..61f3a09d 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,18 +1,18 @@ 'use strict'; module.exports = function (environment) { - const ENV = { - modulePrefix: 'dummy', - environment, - rootURL: '/', - locationType: 'history', - EmberENV: { - EXTEND_PROTOTYPES: false, - FEATURES: { - // Here you can enable experimental features on an ember canary build - // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true - }, - }, + const ENV = { + modulePrefix: 'dummy', + environment, + rootURL: '/', + locationType: 'history', + EmberENV: { + EXTEND_PROTOTYPES: false, + FEATURES: { + // Here you can enable experimental features on an ember canary build + // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true + }, + }, APP: { // Here you can pass flags/options to your application instance