Make code prettier

This updates ESLint and our shared eslint-config-openlayers to use Prettier.  Most formatting changes were automatically applied with this:

    npm run lint -- --fix

A few manual changes were required:

 * In `examples/offscreen-canvas.js`, the `//eslint-disable-line` comment needed to be moved to the appropriate line to disable the error about the `'worker-loader!./offscreen-canvas.worker.js'` import.
 * In `examples/webpack/exapmle-builder.js`, spaces could not be added after a couple `function`s for some reason.  While editing this, I reworked `ExampleBuilder` to be a class.
 * In `src/ol/format/WMSGetFeatureInfo.js`, the `// @ts-ignore` comment needed to be moved down one line so it applied to the `parsersNS` argument.
This commit is contained in:
Tim Schaub
2020-04-06 12:25:12 -06:00
parent 53b48baf62
commit 054af09032
790 changed files with 46833 additions and 33765 deletions

View File

@@ -1,6 +1,6 @@
const path = require('path');
module.exports = function(karma) {
module.exports = function (karma) {
karma.set({
browsers: ['Chrome'],
browserDisconnectTolerance: 2,
@@ -8,58 +8,76 @@ module.exports = function(karma) {
client: {
runInParent: true,
mocha: {
timeout: 2500
}
timeout: 2500,
},
},
files: [
{
pattern: path.resolve(__dirname, require.resolve('url-polyfill/url-polyfill.js')),
watched: false
pattern: path.resolve(
__dirname,
require.resolve('url-polyfill/url-polyfill.js')
),
watched: false,
},
{
pattern: 'module-global.js',
watched: false
}, {
pattern: path.resolve(__dirname, require.resolve('jquery/dist/jquery.js')),
watched: false
}, {
watched: false,
},
{
pattern: path.resolve(
__dirname,
require.resolve('jquery/dist/jquery.js')
),
watched: false,
},
{
pattern: path.resolve(__dirname, require.resolve('expect.js/index.js')),
watched: false
}, {
watched: false,
},
{
pattern: path.resolve(__dirname, require.resolve('sinon/pkg/sinon.js')),
watched: false
}, {
pattern: path.resolve(__dirname, require.resolve('proj4/dist/proj4.js')),
watched: false
}, {
pattern: path.resolve(__dirname, require.resolve('pixelmatch/index.js')),
watched: false
}, {
pattern: path.resolve(__dirname, './test-extensions.js')
}, {
watched: false,
},
{
pattern: path.resolve(
__dirname,
require.resolve('proj4/dist/proj4.js')
),
watched: false,
},
{
pattern: path.resolve(
__dirname,
require.resolve('pixelmatch/index.js')
),
watched: false,
},
{
pattern: path.resolve(__dirname, './test-extensions.js'),
},
{
pattern: path.resolve(__dirname, './index_test.js'),
watched: false
}, {
watched: false,
},
{
pattern: '**/*',
included: false,
watched: false
}
],
exclude: [
'**/*.test.js'
watched: false,
},
],
exclude: ['**/*.test.js'],
proxies: {
'/rendering/': '/base/rendering/',
'/spec/': '/base/spec/'
'/spec/': '/base/spec/',
},
preprocessors: {
'**/*.js': ['webpack', 'sourcemap']
'**/*.js': ['webpack', 'sourcemap'],
},
reporters: ['dots', 'coverage-istanbul'],
coverageIstanbulReporter: {
reports: ['text-summary', 'html'],
dir: path.resolve(__dirname, '../coverage/'),
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
webpack: {
devtool: 'inline-source-map',
@@ -71,36 +89,39 @@ module.exports = function(karma) {
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
presets: ['@babel/preset-env'],
},
},
include: path.resolve('src/ol/'),
exclude: path.resolve('node_modules/')
}, {
exclude: path.resolve('node_modules/'),
},
{
test: /\.js$/,
use: {
loader: 'istanbul-instrumenter-loader',
options: {
esModules: true
}
esModules: true,
},
},
include: path.resolve('src/ol/'),
exclude: path.resolve('node_modules/')
}, {
exclude: path.resolve('node_modules/'),
},
{
test: /\.js$/,
use: {
loader: path.join(__dirname, '../examples/webpack/worker-loader.js')
loader: path.join(
__dirname,
'../examples/webpack/worker-loader.js'
),
},
include: [
path.join(__dirname, '../src/ol/worker')
]
}
]
}
include: [path.join(__dirname, '../src/ol/worker')],
},
],
},
},
webpackMiddleware: {
noInfo: true
}
noInfo: true,
},
});
process.env.CHROME_BIN = require('puppeteer').executablePath();