Initial import with skill sheet working

This commit is contained in:
2024-12-04 00:11:23 +01:00
commit 9050c80ab4
4488 changed files with 671048 additions and 0 deletions

15
node_modules/prettier-linter-helpers/.editorconfig generated vendored Normal file
View File

@ -0,0 +1,15 @@
# editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
# Markdown syntax specifies that trailing whitespaces can be meaningful,
# so lets not trim those. e.g. 2 trailing spaces = linebreak (<br />)
# See https://daringfireball.net/projects/markdown/syntax#p
[*.md]
trim_trailing_whitespace = false

2
node_modules/prettier-linter-helpers/.eslintignore generated vendored Normal file
View File

@ -0,0 +1,2 @@
!.eslintrc.js
node_modules

6
node_modules/prettier-linter-helpers/.eslintrc.js generated vendored Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
plugins: ['node'],
extends: ['plugin:node/recommended', 'plugin:prettier/recommended'],
env: {mocha: true},
root: true,
};

View File

@ -0,0 +1,41 @@
# Contributing
Thanks for contributing!
## Installation
```sh
git clone https://github.com/prettier/prettier-linter-helpers.git
cd prettier-linter-helpers
yarn install
```
## Running the tests
```sh
yarn run test
```
Linting is ran as part of `yarn run test`. The build will fail if there are any linting errors. You can run `yarn run lint --fix` to fix some linting errors (including formatting to match prettier's expectations). To run the tests without linting run `yarn run test`.
## Publishing
- Ensure you are on the master branch locally.
- Update `CHANGELOG.md` and commit.
- Run the following:
```sh
yarn publish
git push --follow-tags
```
Running `yarn publish` shall:
- Bump the version in package.json (asking you for the new version number)
- Create a new commit containing that version bump in package.json
- Create a tag for that commit
- Publish to the npm repository
Running `git push --follow-tags` shall:
- Push the commit and tag to GitHub

1
node_modules/prettier-linter-helpers/.prettierignore generated vendored Normal file
View File

@ -0,0 +1 @@
package.json

6
node_modules/prettier-linter-helpers/.prettierrc generated vendored Normal file
View File

@ -0,0 +1,6 @@
{
"arrowParens": "always",
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": false
}

View File

@ -0,0 +1,12 @@
{
"editor.formatOnSave": true,
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/node_modules": true
},
"prettier.eslintIntegration": true,
"search.exclude": {
"**/node_modules": true
}
}

24
node_modules/prettier-linter-helpers/LICENSE.md generated vendored Normal file
View File

@ -0,0 +1,24 @@
# The MIT License (MIT)
Copyright © 2017 Andres Suarez and Teddy Katz
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

14
node_modules/prettier-linter-helpers/README.md generated vendored Normal file
View File

@ -0,0 +1,14 @@
# prettier-linter-helpers
Helper functions for exposing prettier changes within linting tools.
This package contains:
- `showInvisibles(string)` - Replace invisible characters with ones you can see for
for easier diffing.
- `generateDifferences(source, prettierSource)` - Generate an array of
differences between two strings.
## Inspiration
This code was extracted from [eslint-plugin-prettier v2.7.0](https://github.com/prettier/eslint-plugin-prettier/blob/v2.7.0/eslint-plugin-prettier.js#L85-L215)

145
node_modules/prettier-linter-helpers/index.js generated vendored Normal file
View File

@ -0,0 +1,145 @@
const diff = require('fast-diff');
const LINE_ENDING_RE = /\r\n|[\r\n\u2028\u2029]/;
/**
* Converts invisible characters to a commonly recognizable visible form.
* @param {string} str - The string with invisibles to convert.
* @returns {string} The converted string.
*/
function showInvisibles(str) {
let ret = '';
for (let i = 0; i < str.length; i++) {
switch (str[i]) {
case ' ':
ret += '·'; // Middle Dot, \u00B7
break;
case '\n':
ret += '⏎'; // Return Symbol, \u23ce
break;
case '\t':
ret += '↹'; // Left Arrow To Bar Over Right Arrow To Bar, \u21b9
break;
case '\r':
ret += '␍'; // Carriage Return Symbol, \u240D
break;
default:
ret += str[i];
break;
}
}
return ret;
}
/**
* Generate results for differences between source code and formatted version.
*
* @param {string} source - The original source.
* @param {string} prettierSource - The Prettier formatted source.
* @returns {Array} - An array containing { operation, offset, insertText, deleteText }
*/
function generateDifferences(source, prettierSource) {
// fast-diff returns the differences between two texts as a series of
// INSERT, DELETE or EQUAL operations. The results occur only in these
// sequences:
// /-> INSERT -> EQUAL
// EQUAL | /-> EQUAL
// \-> DELETE |
// \-> INSERT -> EQUAL
// Instead of reporting issues at each INSERT or DELETE, certain sequences
// are batched together and are reported as a friendlier "replace" operation:
// - A DELETE immediately followed by an INSERT.
// - Any number of INSERTs and DELETEs where the joining EQUAL of one's end
// and another's beginning does not have line endings (i.e. issues that occur
// on contiguous lines).
const results = diff(source, prettierSource);
const differences = [];
const batch = [];
let offset = 0; // NOTE: INSERT never advances the offset.
while (results.length) {
const result = results.shift();
const op = result[0];
const text = result[1];
switch (op) {
case diff.INSERT:
case diff.DELETE:
batch.push(result);
break;
case diff.EQUAL:
if (results.length) {
if (batch.length) {
if (LINE_ENDING_RE.test(text)) {
flush();
offset += text.length;
} else {
batch.push(result);
}
} else {
offset += text.length;
}
}
break;
default:
throw new Error(`Unexpected fast-diff operation "${op}"`);
}
if (batch.length && !results.length) {
flush();
}
}
return differences;
function flush() {
let aheadDeleteText = '';
let aheadInsertText = '';
while (batch.length) {
const next = batch.shift();
const op = next[0];
const text = next[1];
switch (op) {
case diff.INSERT:
aheadInsertText += text;
break;
case diff.DELETE:
aheadDeleteText += text;
break;
case diff.EQUAL:
aheadDeleteText += text;
aheadInsertText += text;
break;
}
}
if (aheadDeleteText && aheadInsertText) {
differences.push({
offset,
operation: generateDifferences.REPLACE,
insertText: aheadInsertText,
deleteText: aheadDeleteText,
});
} else if (!aheadDeleteText && aheadInsertText) {
differences.push({
offset,
operation: generateDifferences.INSERT,
insertText: aheadInsertText,
});
} else if (aheadDeleteText && !aheadInsertText) {
differences.push({
offset,
operation: generateDifferences.DELETE,
deleteText: aheadDeleteText,
});
}
offset += aheadDeleteText.length;
}
}
generateDifferences.INSERT = 'insert';
generateDifferences.DELETE = 'delete';
generateDifferences.REPLACE = 'replace';
module.exports = {
showInvisibles,
generateDifferences,
};

38
node_modules/prettier-linter-helpers/package.json generated vendored Normal file
View File

@ -0,0 +1,38 @@
{
"name": "prettier-linter-helpers",
"version": "1.0.0",
"description": "Utilities to help expose prettier output in linting tools",
"contributors": [
"Ben Scott",
"Teddy Katz"
],
"main": "index.js",
"license": "MIT",
"scripts": {
"lint": "eslint .",
"test": "npm run lint && mocha",
"format": "yarn run prettier '**/*.{js,json,md,yml}' --write && yarn run lint --fix"
},
"repository": {
"type": "git",
"url": "git+https://github.com/prettier/prettier-linter-helpers.git"
},
"bugs": {
"url": "https://github.com/prettier/prettier-linter-helpers/issues"
},
"homepage": "https://github.com/prettier/prettier-linter-helpers#readme",
"dependencies": {
"fast-diff": "^1.1.2"
},
"devDependencies": {
"eslint": "^5.6.1",
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-prettier": "^2.7.0",
"mocha": "^5.2.0",
"prettier": "^1.14.3"
},
"engines": {
"node": ">=6.0.0"
}
}

View File

@ -0,0 +1,29 @@
const {showInvisibles, generateDifferences} = require('..');
const assert = require('assert');
describe('showInvisibles', () => {
it('shows invisibles', () => {
assert.strictEqual(showInvisibles('1 2\n3\t4\r5'), '1·2⏎3↹4␍5');
});
});
describe('generateDifferences', () => {
it('operation: insert', () => {
const differences = generateDifferences('abc', 'abcdef');
assert.deepStrictEqual(differences, [
{operation: 'insert', offset: 3, insertText: 'def'},
]);
});
it('operation: delete', () => {
const differences = generateDifferences('abcdef', 'abc');
assert.deepStrictEqual(differences, [
{operation: 'delete', offset: 3, deleteText: 'def'},
]);
});
it('operation: replace', () => {
const differences = generateDifferences('abc', 'def');
assert.deepStrictEqual(differences, [
{operation: 'replace', offset: 0, deleteText: 'abc', insertText: 'def'},
]);
});
});