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

Eslint default and pr template #871

Merged
merged 6 commits into from
Oct 17, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
56 changes: 38 additions & 18 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
"env": {
"browser": true
},
"extends": ["angular"],
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"angular",
"standard",
"prettier"
],
"overrides": [
{
"files": ["app/assets/javascripts/angular/**/*.spec.js"],
Expand All @@ -25,32 +31,57 @@
],
"plugins": ["import"],
"rules": {
"angular/definedundefined": "off",
"angular/typecheck-string": "off",
"angular/no-service-method": "off",
"angular/window-service": "off",
"block-scoped-var": "error",
"camelcase": "off",
"consistent-this": ["error", "_this", "vm"],
"dot-notation": "error",
"eqeqeq": ["error", "smart"],
"max-len": [
"error",
{
"code": 120,
"ignoreRegExpLiterals": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreTrailingComments": true,
"ignoreUrls": true
}
],
"import/order": [
2,
{
"newlines-between": "always"
}
],
"new-cap": "error",
"new-parens": "error",
"no-alert": "warn",
"no-array-constructor": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-case-declarations": "error",
"no-continue": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-global-assign": "error",
"no-implied-eval": "error",
"no-iterator": "error",
"no-lonely-if": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-str": "error",
"no-negated-condition": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-param-reassign": "error",
Expand All @@ -61,32 +92,21 @@
"no-shadow-restricted-names": "error",
"no-throw-literal": "error",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unsafe-negation": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-escape": "error",
"no-useless-return": "error",
"no-void": "error",
"no-with": "error",
"prettier/prettier": [
"error",
{ "singleQuote": true, "tabWidth": 2 }
],
"radix": "error",
"strict": ["error", "function"],
"wrap-iife": ["error", "inside"],
"yoda": "error",

"consistent-this": ["error", "_this", "vm"],
"new-cap": "error",
"new-parens": "error",
"no-array-constructor": "error",
"no-bitwise": "error",
"no-continue": "error",
"no-lonely-if": "error",
"no-negated-condition": "error",
"no-new-object": "error",
"no-unneeded-ternary": "error",

"angular/definedundefined": "off",
"angular/typecheck-string": "off",
"angular/no-service-method": "off",
"angular/window-service": "off"
"yoda": "error"
}
}
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Description
Please include a summary of the changes. List any PRs that this PR is dependent on.

## Changes
Please include a bullet-point of the changes.
-
-
-

## Checklist:
- [ ] I have given my PR a title with the format "CC-(JIRA#) (summary sentence max 80 chars)"
- [ ] I have applied the appropriate labels
- [ ] I have requested a review from another person on the project
4 changes: 4 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module.exports = {
singleQuote: true,
trailingComma: 'all',
arrowParens: 'always',
semi: true,
printWidth: 120,
tabWidth: 2,
};
56 changes: 25 additions & 31 deletions app/app.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,37 @@ import './components/navigation/navHeader.component';
import './app.scss';

angular.module('campusContactsApp').component('app', {
controller: appController,
template: template,
bindings: {
hideHeader: '<',
hideFooter: '<',
hideMenuLinks: '<',
},
controller: appController,
template,
bindings: {
hideHeader: '<',
hideFooter: '<',
hideMenuLinks: '<',
},
});

function appController(periodService, $rootScope, analyticsService) {
let deregisterEditOrganizationsEvent;
let deregisterStateChangedEvent;
let deregisterEditOrganizationsEvent;
let deregisterStateChangedEvent;

this.editOrganizations = false;
this.getPeriod = periodService.getPeriod;
this.editOrganizations = false;
this.getPeriod = periodService.getPeriod;

this.$onInit = () => {
this.year = new Date();
this.$onInit = () => {
this.year = new Date();

deregisterStateChangedEvent = $rootScope.$on(
'state:changed',
(event, { loggedIn }) => {
if (loggedIn) analyticsService.setupAuthenitcatedAnalyticData();
else analyticsService.clearAuthenticatedData();
},
);
deregisterStateChangedEvent = $rootScope.$on('state:changed', (event, { loggedIn }) => {
if (loggedIn) analyticsService.setupAuthenitcatedAnalyticData();
else analyticsService.clearAuthenticatedData();
});

deregisterEditOrganizationsEvent = $rootScope.$on(
'editOrganizations',
(event, value) => {
this.editOrganizations = value;
},
);
};
deregisterEditOrganizationsEvent = $rootScope.$on('editOrganizations', (event, value) => {
this.editOrganizations = value;
});
};

this.$onDestroy = () => {
deregisterEditOrganizationsEvent();
deregisterStateChangedEvent();
};
this.$onDestroy = () => {
deregisterEditOrganizationsEvent();
deregisterStateChangedEvent();
};
}
48 changes: 20 additions & 28 deletions app/app.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
<header ng-cloak ng-if="!$ctrl.hideHeader">
<toaster-container
toaster-options="{ 'close-button': true }"
></toaster-container>
<nav-header hide-menu-links="$ctrl.hideMenuLinks"></nav-header>
<dashboard-subnav></dashboard-subnav>
<toaster-container toaster-options="{ 'close-button': true }"></toaster-container>
<nav-header hide-menu-links="$ctrl.hideMenuLinks"></nav-header>
<dashboard-subnav></dashboard-subnav>
</header>
<section class="main-container ph1 ph3-l pt4 pb2 flex-grow-5 w-100" ng-cloak>
<ui-view></ui-view>
<ui-view></ui-view>
</section>
<footer class="tc bg-white pt4 pb4" ng-cloak ng-if="!$ctrl.hideFooter">
<section class="main-container flex-grow-5 pivot-gray-7">
<span class="copyright">
<!-- prettier-ignore -->
{{ 'nav.copyright' | t: { year: ($ctrl.year | date: 'yyyy') } }}
</span>
<span>
<a
href="https://www.cru.org/us/en/about/terms-of-use.html"
target="_blank"
class="ml3 pivot-gray-7"
>{{ 'nav.terms' | t }}</a
>
</span>
<span>
<a
href="https://www.cru.org/us/en/about/privacy.html"
target="_blank"
class="ml3 pivot-gray-7"
>{{ 'nav.privacy' | t }}</a
>
</span>
</section>
<section class="main-container flex-grow-5 pivot-gray-7">
<span class="copyright">
<!-- prettier-ignore -->
{{ 'nav.copyright' | t: { year: ($ctrl.year | date: 'yyyy') } }}
</span>
<span>
<a href="https://www.cru.org/us/en/about/terms-of-use.html" target="_blank" class="ml3 pivot-gray-7"
>{{ 'nav.terms' | t }}</a
>
</span>
<span>
<a href="https://www.cru.org/us/en/about/privacy.html" target="_blank" class="ml3 pivot-gray-7"
>{{ 'nav.privacy' | t }}</a
>
</span>
</section>
</footer>
37 changes: 18 additions & 19 deletions app/assets/javascripts/angular/all-tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@ import angular from 'angular';
import 'angular-mocks';

class OktaAuth {
constructor(config) {
this.token = '';
this.tokenManager = {};
}
start() {}
signOut() {}
constructor(config) {
this.token = '';
this.tokenManager = {};
}

start() {}
signOut() {}
}

window.OktaAuth = OktaAuth;

beforeEach(angular.mock.module('campusContactsApp'));

beforeEach(
angular.mock.module({
analyticsService: {
init: jasmine.createSpy('init'),
track: jasmine.createSpy('track'),
},
authenticationService: {
storeJwtToken: jasmine.createSpy('storeJwtToken'),
removeAccess: jasmine.createSpy('removeAccess'),
isTokenValid: jasmine
.createSpy('isTokenValid')
.and.returnValue(false),
},
}),
angular.mock.module({
analyticsService: {
init: jasmine.createSpy('init'),
track: jasmine.createSpy('track'),
},
authenticationService: {
storeJwtToken: jasmine.createSpy('storeJwtToken'),
removeAccess: jasmine.createSpy('removeAccess'),
isTokenValid: jasmine.createSpy('isTokenValid').and.returnValue(false),
},
}),
);

/* global require */
Expand Down
Loading