Skip to content

Commit

Permalink
chore: update prettier config (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed May 25, 2021
1 parent ae3b128 commit 2fc216f
Show file tree
Hide file tree
Showing 22 changed files with 912 additions and 913 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ['@webpack-contrib/eslint-config-webpack', 'prettier'],
extends: ["@webpack-contrib/eslint-config-webpack", "prettier"],
};
1 change: 0 additions & 1 deletion .prettierrc.js

This file was deleted.

58 changes: 29 additions & 29 deletions README.md
Expand Up @@ -46,11 +46,11 @@ npm install schema-utils
```

```js
import schema from './path/to/schema.json';
import { validate } from 'schema-utils';
import schema from "./path/to/schema.json";
import { validate } from "schema-utils";

const options = { option: true };
const configuration = { name: 'Loader Name/Plugin Name/Name' };
const configuration = { name: "Loader Name/Plugin Name/Name" };

validate(schema, options, configuration);
```
Expand Down Expand Up @@ -83,12 +83,12 @@ Type: `Object`
Object with options.

```js
import schema from './path/to/schema.json';
import { validate } from 'schema-utils';
import schema from "./path/to/schema.json";
import { validate } from "schema-utils";

const options = { foo: 'bar' };
const options = { foo: "bar" };

validate(schema, { name: 123 }, { name: 'MyPlugin' });
validate(schema, { name: 123 }, { name: "MyPlugin" });
```

### `configuration`
Expand Down Expand Up @@ -123,12 +123,12 @@ Default: `"Object"`
Allow to setup name in validation errors.

```js
import schema from './path/to/schema.json';
import { validate } from 'schema-utils';
import schema from "./path/to/schema.json";
import { validate } from "schema-utils";

const options = { foo: 'bar' };
const options = { foo: "bar" };

validate(schema, options, { name: 'MyPlugin' });
validate(schema, options, { name: "MyPlugin" });
```

```shell
Expand All @@ -144,12 +144,12 @@ Default: `"configuration"`
Allow to setup base data path in validation errors.

```js
import schema from './path/to/schema.json';
import { validate } from 'schema-utils';
import schema from "./path/to/schema.json";
import { validate } from "schema-utils";

const options = { foo: 'bar' };
const options = { foo: "bar" };

validate(schema, options, { name: 'MyPlugin', baseDataPath: 'options' });
validate(schema, options, { name: "MyPlugin", baseDataPath: "options" });
```

```shell
Expand All @@ -165,15 +165,15 @@ Default: `undefined`
Allow to reformat errors.

```js
import schema from './path/to/schema.json';
import { validate } from 'schema-utils';
import schema from "./path/to/schema.json";
import { validate } from "schema-utils";

const options = { foo: 'bar' };
const options = { foo: "bar" };

validate(schema, options, {
name: 'MyPlugin',
name: "MyPlugin",
postFormatter: (formattedError, error) => {
if (error.keyword === 'type') {
if (error.keyword === "type") {
return `${formattedError}\nAdditional Information.`;
}

Expand Down Expand Up @@ -220,17 +220,17 @@ Invalid options object. MyPlugin has been initialized using an options object th
### `Loader`

```js
import { getOptions } from 'loader-utils';
import { validate } from 'schema-utils';
import { getOptions } from "loader-utils";
import { validate } from "schema-utils";

import schema from 'path/to/schema.json';
import schema from "path/to/schema.json";

function loader(src, map) {
const options = getOptions(this);

validate(schema, options, {
name: 'Loader Name',
baseDataPath: 'options',
name: "Loader Name",
baseDataPath: "options",
});

// Code...
Expand All @@ -242,15 +242,15 @@ export default loader;
### `Plugin`

```js
import { validate } from 'schema-utils';
import { validate } from "schema-utils";

import schema from 'path/to/schema.json';
import schema from "path/to/schema.json";

class Plugin {
constructor(options) {
validate(schema, options, {
name: 'Plugin Name',
baseDataPath: 'options',
name: "Plugin Name",
baseDataPath: "options",
});

this.options = options;
Expand Down
4 changes: 2 additions & 2 deletions babel.config.js
Expand Up @@ -7,10 +7,10 @@ module.exports = (api) => {
return {
presets: [
[
'@babel/preset-env',
"@babel/preset-env",
{
targets: {
node: '10.13.0',
node: "10.13.0",
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
@@ -1,3 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
extends: ["@commitlint/config-conventional"],
};
12 changes: 6 additions & 6 deletions declarations/ValidationError.d.ts
@@ -1,11 +1,11 @@
export default ValidationError;
export type JSONSchema6 = import('json-schema').JSONSchema6;
export type JSONSchema7 = import('json-schema').JSONSchema7;
export type Schema = import('./validate').Schema;
export type JSONSchema6 = import("json-schema").JSONSchema6;
export type JSONSchema7 = import("json-schema").JSONSchema7;
export type Schema = import("./validate").Schema;
export type ValidationErrorConfiguration =
import('./validate').ValidationErrorConfiguration;
export type PostFormatter = import('./validate').PostFormatter;
export type SchemaUtilErrorObject = import('./validate').SchemaUtilErrorObject;
import("./validate").ValidationErrorConfiguration;
export type PostFormatter = import("./validate").PostFormatter;
export type SchemaUtilErrorObject = import("./validate").SchemaUtilErrorObject;
declare class ValidationError extends Error {
/**
* @param {Array<SchemaUtilErrorObject>} errors
Expand Down
4 changes: 2 additions & 2 deletions declarations/index.d.ts
@@ -1,3 +1,3 @@
import { validate } from './validate';
import { ValidationError } from './validate';
import { validate } from "./validate";
import { ValidationError } from "./validate";
export { validate, ValidationError };
6 changes: 3 additions & 3 deletions declarations/keywords/absolutePath.d.ts
@@ -1,7 +1,7 @@
export default addAbsolutePathKeyword;
export type Ajv = import('ajv').Ajv;
export type ValidateFunction = import('ajv').ValidateFunction;
export type SchemaUtilErrorObject = import('../validate').SchemaUtilErrorObject;
export type Ajv = import("ajv").Ajv;
export type ValidateFunction = import("ajv").ValidateFunction;
export type SchemaUtilErrorObject = import("../validate").SchemaUtilErrorObject;
/**
*
* @param {Ajv} ajv
Expand Down
4 changes: 2 additions & 2 deletions declarations/util/Range.d.ts
Expand Up @@ -14,9 +14,9 @@ declare class Range {
* @returns {">" | ">=" | "<" | "<="}
*/
static getOperator(
side: 'left' | 'right',
side: "left" | "right",
exclusive: boolean
): '>' | '>=' | '<' | '<=';
): ">" | ">=" | "<" | "<=";
/**
* @param {number} value
* @param {boolean} logic is not logic applied
Expand Down
2 changes: 1 addition & 1 deletion declarations/util/hints.d.ts
@@ -1,3 +1,3 @@
export function stringHints(schema: Schema, logic: boolean): string[];
export function numberHints(schema: Schema, logic: boolean): string[];
export type Schema = import('../validate').Schema;
export type Schema = import("../validate").Schema;
10 changes: 5 additions & 5 deletions declarations/validate.d.ts
@@ -1,7 +1,7 @@
export type JSONSchema4 = import('json-schema').JSONSchema4;
export type JSONSchema6 = import('json-schema').JSONSchema6;
export type JSONSchema7 = import('json-schema').JSONSchema7;
export type ErrorObject = import('ajv').ErrorObject;
export type JSONSchema4 = import("json-schema").JSONSchema4;
export type JSONSchema6 = import("json-schema").JSONSchema6;
export type JSONSchema7 = import("json-schema").JSONSchema7;
export type ErrorObject = import("ajv").ErrorObject;
export type Extend = {
formatMinimum?: number | undefined;
formatMaximum?: number | undefined;
Expand Down Expand Up @@ -32,5 +32,5 @@ export function validate(
options: Array<object> | object,
configuration?: ValidationErrorConfiguration | undefined
): void;
import ValidationError from './ValidationError';
import ValidationError from "./ValidationError";
export { ValidationError };
4 changes: 2 additions & 2 deletions lint-staged.config.js
@@ -1,4 +1,4 @@
module.exports = {
'*.js': ['eslint --fix', 'prettier --write'],
'*.{json,md,yml,css,ts}': ['prettier --write'],
"*.js": ["eslint --fix", "prettier --write"],
"*.{json,md,yml,css,ts}": ["prettier --write"],
};

0 comments on commit 2fc216f

Please sign in to comment.