Skip to content

Commit 0d09021

Browse files
authored
Install and configure eslint (#282)
1 parent 604dd99 commit 0d09021

File tree

105 files changed

+264
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+264
-197
lines changed

.webpack/webpack.common.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global __dirname module */
2-
31
const path = require('path');
42
const packageDefinition = require('../package.json');
53
const webpack = require('webpack');
@@ -100,7 +98,7 @@ const config = {
10098
bourbon: 'bourbon.scss',
10199
printj: path.join(__dirname, '..', 'node_modules/printj/dist/printj.min.js'),
102100
/**
103-
* VISTA Paths
101+
* OMM Paths
104102
**/
105103
types: path.join(__dirname, '..', 'src/types'),
106104
services: path.join(__dirname, '..', 'src/services'),
@@ -112,10 +110,10 @@ const config = {
112110
},
113111
plugins: [
114112
new webpack.DefinePlugin({
115-
__VISTA_VERSION__: `'${packageDefinition.version}'`,
116-
__VISTA_BUILD_DATE__: `'${new Date()}'`,
117-
__VISTA_REVISION__: `'${gitRevision}'`,
118-
__VISTA_BUILD_BRANCH__: `'${gitBranch}'`,
113+
__OMM_VERSION__: `'${packageDefinition.version}'`,
114+
__OMM_BUILD_DATE__: `'${new Date()}'`,
115+
__OMM_REVISION__: `'${gitRevision}'`,
116+
__OMM_BUILD_BRANCH__: `'${gitBranch}'`,
119117
__VUE_OPTIONS_API__: true, // enable/disable Options API support, default: true
120118
__VUE_PROD_DEVTOOLS__: false // enable/disable devtools support in production, default: false
121119
}),

.webpack/webpack.dev.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global __dirname module*/
2-
31
/*
42
This configuration should be used for development purposes. It contains full source map, a
53
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.

.webpack/webpack.prod.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
/* global __dirname module */
2-
31
/*
42
This configuration should be used for production installs.
53
It is the default webpack configuration.
64
*/
75

86
const { merge } = require('webpack-merge');
97
const common = require('./webpack.common');
10-
const path = require('path');
118

129
/** @type {import('webpack').Configuration} */
1310
module.exports = merge(common, {

eslint.config.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
const globals = require('globals');
2+
const js = require('@eslint/js');
3+
const vueParser = require('vue-eslint-parser');
4+
const babelParser = require('@babel/eslint-parser');
5+
// eslint-plugin-prettier/recommended must be last in configuration
6+
// so that eslint-config-prettier has the opportunity to override other configs
7+
const prettierRecommended = require('eslint-plugin-prettier/recommended');
8+
9+
/** @type {import('eslint').Linter.Config[]} */
10+
module.exports = [
11+
{
12+
ignores: ['**/dist/*', '**/target/*']
13+
},
14+
{
15+
languageOptions: {
16+
globals: {
17+
...globals.browser,
18+
...globals.es2024,
19+
...globals.jasmine,
20+
...globals.amd,
21+
...globals.node,
22+
__OMM_VERSION__: 'readonly',
23+
__OMM_BUILD_DATE__: 'readonly',
24+
__OMM_REVISION__: 'readonly',
25+
__OMM_BUILD_BRANCH__: 'readonly'
26+
},
27+
parser: vueParser,
28+
parserOptions: {
29+
parser: babelParser,
30+
requireConfigFile: false,
31+
allowImportExportEverywhere: true,
32+
ecmaVersion: 'latest',
33+
ecmaFeatures: {
34+
impliedStrict: true
35+
},
36+
sourceType: 'module'
37+
}
38+
}
39+
},
40+
js.configs.recommended,
41+
prettierRecommended,
42+
{
43+
rules: {
44+
'no-unused-vars': [
45+
'error',
46+
{
47+
vars: 'all',
48+
args: 'none'
49+
}
50+
],
51+
'prettier/prettier': 'error'
52+
}
53+
}
54+
];

karma.conf.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/*global module*/
2-
31
const path = require('path');
42

53
module.exports = function (config) {
@@ -13,7 +11,6 @@ module.exports = function (config) {
1311
use: {
1412
loader: 'babel-loader',
1513
options: {
16-
// eslint-disable-next-line no-undef
1714
configFile: path.resolve(process.cwd(), 'babel.coverage.js')
1815
}
1916
}

loader.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ define([
141141
*/
142142
function insertBuildInfo(markup) {
143143
return markup
144-
.replace(/\$\{project\.version\}/g, __VISTA_VERSION__)
145-
.replace(/\$\{timestamp\}/g, __VISTA_BUILD_DATE__)
146-
.replace(/\$\{buildNumber\}/g, __VISTA_REVISION__)
147-
.replace(/\$\{branch\}/g, __VISTA_BUILD_BRANCH__);
144+
.replace(/\$\{project\.version\}/g, __OMM_VERSION__)
145+
.replace(/\$\{timestamp\}/g, __OMM_BUILD_DATE__)
146+
.replace(/\$\{buildNumber\}/g, __OMM_REVISION__)
147+
.replace(/\$\{branch\}/g, __OMM_BUILD_BRANCH__);
148148
}
149149

150150
return loader;

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@
33
"version": "2512.01-next",
44
"description": "Open MCT for MCWS",
55
"devDependencies": {
6+
"@babel/eslint-parser": "7.26.8",
67
"@braintree/sanitize-url": "6.0.4",
8+
"@eslint/js": "9.19.0",
79
"@vue/compiler-sfc": "3.4.3",
810
"babel-loader": "8.2.0",
911
"babel-plugin-istanbul": "6.1.1",
1012
"bower": "^1.7.7",
1113
"comma-separated-values": "3.6.4",
1214
"copy-webpack-plugin": "12.0.2",
1315
"css-loader": "6.10.0",
16+
"eslint": "9.19.0",
17+
"eslint-config-prettier": "10.0.1",
18+
"eslint-plugin-prettier": "5.2.3",
19+
"eslint-plugin-vue": "9.32.0",
1420
"eventemitter3": "5.0.1",
1521
"file-saver": "2.0.5",
1622
"git-rev-sync": "3.0.2",
23+
"globals": "15.14.0",
1724
"html2canvas": "1.4.1",
1825
"imports-loader": "0.8.0",
1926
"jasmine-core": "5.1.1",
@@ -42,6 +49,7 @@
4249
"source-map-loader": "^0.2.4",
4350
"style-loader": "3.3.3",
4451
"vue": "3.4.24",
52+
"vue-eslint-parser": "^9.4.3",
4553
"vue-loader": "16.8.3",
4654
"webpack": "5.94.0",
4755
"webpack-cli": "5.1.1",
@@ -51,8 +59,8 @@
5159
"scripts": {
5260
"clean": "npm cache clean --force;rm -rf ./dist ./node_modules ./target ./package-lock.json",
5361
"start": "npx webpack serve --config ./.webpack/webpack.dev.js",
54-
"lint": "npx prettier --check \"**\"",
55-
"lint:fix": "npx prettier --write \"**\"",
62+
"lint": "eslint \"**\"",
63+
"lint:fix": "eslint \"**\" --fix",
5664
"build:prod": "webpack --config ./.webpack/webpack.prod.js",
5765
"build:dev": "webpack --config ./.webpack/webpack.dev.js",
5866
"build:watch": "webpack --config ./.webpack/webpack.dev.js --watch",
@@ -72,4 +80,4 @@
7280
},
7381
"author": "",
7482
"license": "Apache-2.0"
75-
}
83+
}

scripts/summarize-report.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ if (!args['exclude-requirements-matrix']) {
296296
console.log('Requirement ID | Test Procedures | Status');
297297
console.log('--- | --- | --- ');
298298
_.each(sortedRequirements, function (requirement) {
299-
var procedureCount = requirement.procedures.length;
300299
var implemented = _.filter(requirement.procedures, { implemented: true }).length;
301300
var conducted = _.filter(requirement.procedures, { conducted: true }).length;
302301
var verified = _.filter(requirement.procedures, { conducted: true, passed: true }).length;

src/AMMOSPlugins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ define([
8787
options: timePlugin,
8888
format: utcFormat
8989
});
90-
openmct.install(RealtimeIndicatorPlugin.default(vistaTime));
90+
openmct.install(RealtimeIndicatorPlugin.default(vistaTime, utcFormat));
9191

9292
mcwsClient.default.configure(options);
9393

src/actionModifiers/ImportExportWithDatasets/importWithDatasetsModifier.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function importWithDatasetsModifier(openmct) {
9898
try {
9999
json = JSON.parse(objectTree);
100100
} catch (error) {
101+
console.error('Error parsing object tree.', error);
101102
success = false;
102103
}
103104

@@ -115,6 +116,7 @@ function importWithDatasetsModifier(openmct) {
115116

116117
component.updateData(referencedDatasets, datasets);
117118
} catch (error) {
119+
console.error('Error updating referenced datasets.', error);
118120
success = false;
119121
}
120122
}
@@ -158,7 +160,7 @@ function importWithDatasetsModifier(openmct) {
158160
};
159161
const componentOptions = { element };
160162

161-
const { componentInstance, destroy, el } = mount(componentDefinition, componentOptions);
163+
const { componentInstance, destroy } = mount(componentDefinition, componentOptions);
162164

163165
component = componentInstance;
164166

0 commit comments

Comments
 (0)