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:
@@ -13,7 +13,6 @@
|
||||
* @property {Array<string>} families
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* The CSS class for hidden feature.
|
||||
*
|
||||
@@ -22,7 +21,6 @@
|
||||
*/
|
||||
export const CLASS_HIDDEN = 'ol-hidden';
|
||||
|
||||
|
||||
/**
|
||||
* The CSS class that we'll give the DOM elements to have them selectable.
|
||||
*
|
||||
@@ -31,7 +29,6 @@ export const CLASS_HIDDEN = 'ol-hidden';
|
||||
*/
|
||||
export const CLASS_SELECTABLE = 'ol-selectable';
|
||||
|
||||
|
||||
/**
|
||||
* The CSS class that we'll give the DOM elements to have them unselectable.
|
||||
*
|
||||
@@ -40,7 +37,6 @@ export const CLASS_SELECTABLE = 'ol-selectable';
|
||||
*/
|
||||
export const CLASS_UNSELECTABLE = 'ol-unselectable';
|
||||
|
||||
|
||||
/**
|
||||
* The CSS class for unsupported feature.
|
||||
*
|
||||
@@ -49,7 +45,6 @@ export const CLASS_UNSELECTABLE = 'ol-unselectable';
|
||||
*/
|
||||
export const CLASS_UNSUPPORTED = 'ol-unsupported';
|
||||
|
||||
|
||||
/**
|
||||
* The CSS class for controls.
|
||||
*
|
||||
@@ -58,7 +53,6 @@ export const CLASS_UNSUPPORTED = 'ol-unsupported';
|
||||
*/
|
||||
export const CLASS_CONTROL = 'ol-control';
|
||||
|
||||
|
||||
/**
|
||||
* The CSS class that we'll give the DOM elements that are collapsed, i.e.
|
||||
* to those elements which usually can be expanded.
|
||||
@@ -72,22 +66,25 @@ export const CLASS_COLLAPSED = 'ol-collapsed';
|
||||
* From http://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font
|
||||
* @type {RegExp}
|
||||
*/
|
||||
const fontRegEx = new RegExp([
|
||||
'^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)',
|
||||
'(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)',
|
||||
'(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)',
|
||||
'(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?',
|
||||
'(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))',
|
||||
'(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))',
|
||||
'?\\s*([-,\\"\\\'\\sa-z]+?)\\s*$'
|
||||
].join(''), 'i');
|
||||
const fontRegEx = new RegExp(
|
||||
[
|
||||
'^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)',
|
||||
'(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)',
|
||||
'(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)',
|
||||
'(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?',
|
||||
'(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))',
|
||||
'(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))',
|
||||
'?\\s*([-,\\"\\\'\\sa-z]+?)\\s*$',
|
||||
].join(''),
|
||||
'i'
|
||||
);
|
||||
const fontRegExMatchIndex = [
|
||||
'style',
|
||||
'variant',
|
||||
'weight',
|
||||
'size',
|
||||
'lineHeight',
|
||||
'family'
|
||||
'family',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -96,7 +93,7 @@ const fontRegExMatchIndex = [
|
||||
* @param {string} fontSpec The CSS font property.
|
||||
* @return {FontParameters} The font parameters (or null if the input spec is invalid).
|
||||
*/
|
||||
export const getFontParameters = function(fontSpec) {
|
||||
export const getFontParameters = function (fontSpec) {
|
||||
const match = fontSpec.match(fontRegEx);
|
||||
if (!match) {
|
||||
return null;
|
||||
@@ -106,7 +103,7 @@ export const getFontParameters = function(fontSpec) {
|
||||
size: '1.2em',
|
||||
style: 'normal',
|
||||
weight: 'normal',
|
||||
variant: 'normal'
|
||||
variant: 'normal',
|
||||
});
|
||||
for (let i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) {
|
||||
const value = match[i + 1];
|
||||
|
||||
Reference in New Issue
Block a user