Skip to content

Commit

Permalink
Add eslint. Add jest tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mixxen committed Apr 18, 2024
1 parent a17212e commit f1ab145
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist/**
node_modules/**
webpack.config.js
tests/**
app/**
26 changes: 0 additions & 26 deletions .eslintrc.js

This file was deleted.

17 changes: 17 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "eslint:recommended",
"env": {
"browser": true,
"node": true
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
},
"rules": {
"no-unused-vars": "off"
},
"globals": {
"globalThis": false
}
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/node_modules/
package-lock.json
.DS_Store
/module/
/module/
.eslintcache
/coverage/
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
"url": "https://github.com/ssc-ai/satsimjs/"
},
"main": "src/index.js",
"type": "module",
"scripts": {
"build": "webpack --config webpack.config.js",
"watch": "webpack --config webpack.config.js --watch",
"start": "webpack serve --config webpack.config.js --open",
"test": "jest --verbose --runInBand",
"coverage": "jest --verbose --runInBand --collectCoverage"
"coverage": "jest --verbose --runInBand --collectCoverage",
"lint": "eslint \"./**/*.js\" --cache --quiet"
},
"jest": {
"testEnvironment": "node",
Expand All @@ -31,11 +33,14 @@
]
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.3",
"copy-webpack-plugin": "^9.0.1",
"css-loader": "^6.2.0",
"eslint": "^8.50.0",
"eslint": "^8.57.0",
"eslint-plugin-node": "^11.1.0",
"html-webpack-plugin": "^5.3.2",
"jest": "^29.7.0",
"style-loader": "^3.2.1",
Expand All @@ -45,7 +50,7 @@
"webpack-dev-server": "^4.3.1"
},
"dependencies": {
"cesium": "^1.113.0",
"cesium": "^1.115.0",
"mathjs": "^11.11.1",
"satellite.js": "^5.0.0"
}
Expand Down
16 changes: 10 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import CopyWebpackPlugin from 'copy-webpack-plugin';
import path from 'path';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { fileURLToPath } from 'url';

// The path to the CesiumJS source code
const cesiumSource = 'node_modules/cesium/Source';
const cesiumWorkers = '../Build/Cesium/Workers';
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory

module.exports = {
export default {
context: __dirname,
entry: {
app: './app/index.js'
Expand All @@ -22,7 +26,7 @@ module.exports = {
// add satsim as an alias to the root directory
alias: {
"satsim": path.resolve(__dirname, ".")
}
}
},
module: {
rules: [{
Expand Down

0 comments on commit f1ab145

Please sign in to comment.