Skip to content

Commit

Permalink
refactor: cleanup previous commit changes that were not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-capsule42 committed Aug 8, 2024
1 parent 4ab77c3 commit b787aaf
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 38 deletions.
13 changes: 0 additions & 13 deletions .eslintrc

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

./node_modules/.bin/npm-run-all preCommit test linters postinstall
21 changes: 21 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends("@aurodesignsystem/eslint-config"), {
rules: {
"no-magic-numbers": ["error", {
ignore: [0, 1, 13, 32],
ignoreArrayIndexes: true,
}],
},
}];
26 changes: 13 additions & 13 deletions src/auro-flight-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ export class AuroFlightMain extends LitElement {
// function to define props used within the scope of this component
static get properties() {
return {
stops: { type: Array },
flights: { type: Array },
duration: { type: Number },
arrivalTime: { type: String },
arrivalStation: { type: String },
departureTime: { type: String },
departureStation: { type: String },
reroutedArrivalStation: { type: String },
stops: { type: Array },
flights: { type: Array },
duration: { type: Number },
arrivalTime: { type: String },
arrivalStation: { type: String },
departureTime: { type: String },
departureStation: { type: String },
reroutedArrivalStation: { type: String },
reroutedDepartureStation: { type: String },
};
}
Expand Down Expand Up @@ -71,7 +71,7 @@ export class AuroFlightMain extends LitElement {
* @returns Localized time based from UTC string.
*/
convertTime(time) {
const slicedTime = time.slice(0, -6);
const slicedTime = time.slice(0, -6); // eslint-disable-line no-magic-numbers
const newTime = new Date(slicedTime);
const localizedTime = newTime.toLocaleString('en-US', this.timeTemplate).replace(/^0+/u, '');

Expand Down Expand Up @@ -154,11 +154,11 @@ export class AuroFlightMain extends LitElement {
</time>
<span class="departureStation">
${hasDepartureReroute
? html`
? html`
<span>
${this.reroutedDepartureStation}
</span>`
: html``}
: html``}
<span class=${hasDepartureReroute ? "util_lineThrough" : ""}>
${this.departureStation}
Expand All @@ -173,11 +173,11 @@ export class AuroFlightMain extends LitElement {
</time>
<span class="arrivalStation">
${hasArrivalReroute
? html`
? html`
<span>
${this.reroutedArrivalStation}
</span>`
: html``}
: html``}
<span class=${hasArrivalReroute ? "util_lineThrough" : ""}>
${this.arrivalStation}
Expand Down
12 changes: 6 additions & 6 deletions test/auro-flight-main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ describe('auro-flight-main', () => {
`);

const expectedDepartureCity = `L A X`,
expectedDepartureTime = `12:30 AM`,
expectedReroutedFlight = 'Flight S E A to P V D has been re-routed.';
expectedDepartureTime = `12:30 AM`,
expectedReroutedFlight = 'Flight S E A to P V D has been re-routed.';

const actual = el.shadowRoot.querySelector('.util_displayHiddenVisually').textContent.trim().replace(/\n|\r/g, "");
const departureRerouteSpan = el.shadowRoot.querySelector('.departureStation .util_lineThrough');
Expand All @@ -133,7 +133,7 @@ describe('auro-flight-main', () => {
`);

const expectedArrival = 'and arrives S F O at 11:55 AM',
expectedReroutedFlight = 'Flight S E A to P V D has been re-routed.';
expectedReroutedFlight = 'Flight S E A to P V D has been re-routed.';

const actual = el.shadowRoot.querySelector('.util_displayHiddenVisually').textContent.trim().replace(/\n|\r/g, "");
const departureRerouteSpan = el.shadowRoot.querySelector('.departureStation .util_lineThrough');
Expand All @@ -159,9 +159,9 @@ describe('auro-flight-main', () => {
`);

const expectedDepartureCity = `L A X`,
expectedDepartureTime = `12:30 AM`,
expectedArrival = 'and arrives S F O at 11:55 AM',
expectedReroutedFlight = 'Flight S E A to P V D has been re-routed.';
expectedDepartureTime = `12:30 AM`,
expectedArrival = 'and arrives S F O at 11:55 AM',
expectedReroutedFlight = 'Flight S E A to P V D has been re-routed.';

const actual = el.shadowRoot.querySelector('.util_displayHiddenVisually').textContent.trim().replace(/\n|\r/g, "");
const departureRerouteSpan = el.shadowRoot.querySelector('.departureStation .util_lineThrough');
Expand Down

0 comments on commit b787aaf

Please sign in to comment.