Skip to content

Commit

Permalink
chore: move health files to .github (#1906)
Browse files Browse the repository at this point in the history
  • Loading branch information
SethFalco committed Dec 27, 2023
1 parent 562152a commit c2cacc7
Show file tree
Hide file tree
Showing 27 changed files with 95 additions and 107 deletions.
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

5 changes: 0 additions & 5 deletions SECURITY.md

This file was deleted.

2 changes: 1 addition & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const parseSvg = (data, from) => {
*/
let current = root;
/**
* @type {Array<XastParent>}
* @type {XastParent[]}
*/
const stack = [root];

Expand Down
6 changes: 3 additions & 3 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ const readNumber = (string, cursor) => {
};

/**
* @type {(string: string) => Array<PathDataItem>}
* @type {(string: string) => PathDataItem[]}
*/
const parsePathData = (string) => {
/**
* @type {Array<PathDataItem>}
* @type {PathDataItem[]}
*/
const pathData = [];
/**
Expand Down Expand Up @@ -307,7 +307,7 @@ const stringifyArgs = (command, args, precision, disableSpaceAfterFlags) => {

/**
* @typedef {{
* pathData: Array<PathDataItem>;
* pathData: PathDataItem[];
* precision?: number;
* disableSpaceAfterFlags?: boolean;
* }} StringifyPathDataOptions
Expand Down
4 changes: 2 additions & 2 deletions lib/path.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('stringify path data', () => {
});
it('should configure precision', () => {
/**
* @type {Array<PathDataItem>}
* @type {PathDataItem[]}
*/
const pathData = [
{ command: 'M', args: [0, -1.9876] },
Expand All @@ -169,7 +169,7 @@ describe('stringify path data', () => {
});
it('allows to avoid spaces after arc flags', () => {
/**
* @type {Array<PathDataItem>}
* @type {PathDataItem[]}
*/
const pathData = [
{ command: 'M', args: [0, 0] },
Expand Down
10 changes: 5 additions & 5 deletions lib/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const csstreeWalkSkip = csstree.walk.skip;
*/
const parseRule = (ruleNode, dynamic) => {
/**
* @type {Array<StylesheetDeclaration>}
* @type {StylesheetDeclaration[]}
*/
const declarations = [];
// collect declarations
Expand Down Expand Up @@ -74,10 +74,10 @@ const parseRule = (ruleNode, dynamic) => {
};

/**
* @type {(css: string, dynamic: boolean) => Array<StylesheetRule>}
* @type {(css: string, dynamic: boolean) => StylesheetRule[]}
*/
const parseStylesheet = (css, dynamic) => {
/** @type {Array<StylesheetRule>} */
/** @type {StylesheetRule[]} */
const rules = [];
const ast = csstree.parse(css, {
parseValue: false,
Expand Down Expand Up @@ -108,10 +108,10 @@ const parseStylesheet = (css, dynamic) => {
};

/**
* @type {(css: string) => Array<StylesheetDeclaration>}
* @type {(css: string) => StylesheetDeclaration[]}
*/
const parseStyleDeclarations = (css) => {
/** @type {Array<StylesheetDeclaration>} */
/** @type {StylesheetDeclaration[]} */
const declarations = [];
const ast = csstree.parse(css, {
context: 'declarationList',
Expand Down
10 changes: 3 additions & 7 deletions lib/svgo/coa.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,7 @@ async function action(args, opts, command) {
process.stdin
.on('data', (chunk) => (data += chunk))
.once('end', () =>
processSVGData(config, { input: 'string' }, data, file).then(
resolve,
reject,
),
processSVGData(config, null, data, file).then(resolve, reject),
);
});
// file
Expand All @@ -271,7 +268,7 @@ async function action(args, opts, command) {
} else if (opts.string) {
var data = decodeSVGDatauri(opts.string);

return processSVGData(config, { input: 'string' }, data, output[0]);
return processSVGData(config, null, data, output[0]);
}
}

Expand Down Expand Up @@ -372,8 +369,7 @@ function getFilesDescriptions(config, dir, files, output) {
*/
function optimizeFile(config, file, output) {
return fs.promises.readFile(file, 'utf8').then(
(data) =>
processSVGData(config, { input: 'file', path: file }, data, output, file),
(data) => processSVGData(config, { path: file }, data, output, file),
(error) => checkOptimizeFileError(config, file, output, error),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/svgo/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ exports.decodeSVGDatauri = (str) => {
* @example
* [0, -1, .5, .5] → "0-1 .5.5"
*
* @type {(data: Array<number>, params: CleanupOutDataParams, command?: PathDataCommand) => string}
* @type {(data: number[], params: CleanupOutDataParams, command?: PathDataCommand) => string}
*/
exports.cleanupOutData = (data, params, command) => {
let str = '';
Expand Down
10 changes: 5 additions & 5 deletions lib/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type XastElement = {
type: 'element';
name: string;
attributes: Record<string, string>;
children: Array<XastChild>;
children: XastChild[];
};

export type XastChild =
Expand All @@ -44,7 +44,7 @@ export type XastChild =

export type XastRoot = {
type: 'root';
children: Array<XastChild>;
children: XastChild[];
};

export type XastParent = XastRoot | XastElement;
Expand Down Expand Up @@ -123,11 +123,11 @@ export type StylesheetRule = {
dynamic: boolean;
selector: string;
specificity: Specificity;
declarations: Array<StylesheetDeclaration>;
declarations: StylesheetDeclaration[];
};

export type Stylesheet = {
rules: Array<StylesheetRule>;
rules: StylesheetRule[];
parents: Map<XastElement, XastParent>;
};

Expand Down Expand Up @@ -168,7 +168,7 @@ export type PathDataCommand =

export type PathDataItem = {
command: PathDataCommand;
args: Array<number>;
args: number[];
};

export type DataUri = 'base64' | 'enc' | 'unenc';
2 changes: 1 addition & 1 deletion lib/xast.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const cssSelectOptions = {
};

/**
* @type {(node: XastNode, selector: string) => Array<XastChild>}
* @type {(node: XastNode, selector: string) => XastChild[]}
*/
const querySelectorAll = (node, selector) => {
return selectAll(selector, node, cssSelectOptions);
Expand Down
12 changes: 6 additions & 6 deletions lib/xast.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const { visit, visitSkip, detachNodeFromParent } = require('./xast.js');

/**
* @type {(children: Array<XastElement>) => XastRoot}
* @type {(children: XastElement[]) => XastRoot}
*/
const root = (children) => {
return { type: 'root', children };
Expand All @@ -18,7 +18,7 @@ const root = (children) => {
* @type {(
* name: string,
* attrs?: ?Record<string, string>,
* children?: Array<XastElement>
* children?: XastElement[]
* ) => XastElement}
*/
const x = (name, attrs = null, children = []) => {
Expand All @@ -28,7 +28,7 @@ const x = (name, attrs = null, children = []) => {
test('visit enters into nodes', () => {
const ast = root([x('g', null, [x('rect'), x('circle')]), x('ellipse')]);
/**
* @type {Array<string>}
* @type {string[]}
*/
const entered = [];
visit(ast, {
Expand All @@ -55,7 +55,7 @@ test('visit enters into nodes', () => {
test('visit exits from nodes', () => {
const ast = root([x('g', null, [x('rect'), x('circle')]), x('ellipse')]);
/**
* @type {Array<string>}
* @type {string[]}
*/
const exited = [];
visit(ast, {
Expand All @@ -82,7 +82,7 @@ test('visit exits from nodes', () => {
test('visit skips entering children if node is detached', () => {
const ast = root([x('g', null, [x('rect'), x('circle')]), x('ellipse')]);
/**
* @type {Array<string>}
* @type {string[]}
*/
const entered = [];
visit(ast, {
Expand All @@ -102,7 +102,7 @@ test('visit skips entering children if node is detached', () => {
test('visit skips entering children when symbol is passed', () => {
const ast = root([x('g', null, [x('rect'), x('circle')]), x('ellipse')]);
/**
* @type {Array<string>}
* @type {string[]}
*/
const entered = [];
visit(ast, {
Expand Down
Loading

0 comments on commit c2cacc7

Please sign in to comment.