Skip to content

Commit

Permalink
Fix eslint issues in index.js
Browse files Browse the repository at this point in the history
Add eslint checks to github checks
Update docs and package version
  • Loading branch information
alexprey committed Dec 5, 2019
1 parent 3589f5f commit 7f3143e
Show file tree
Hide file tree
Showing 7 changed files with 999 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- name: npm install, build, and test
run: |
npm install
npm test
npm run lint
npm run test
env:
CI: true
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/test
.eslintrc.json
.gitignore
yarn.lock
yarn.lock
.github
.vscode
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ All notable changes to the "svelte-intellisense" extension will be documented in

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [2.3.3] 05.12.2019

Thanks to [hontas](https://github.com/hontas) for following changes:

- [Added] Svelte V3: Implement component documentation parsing provided by top level comment in HTML markup or in the JS section, marked with `@component` JSDoc attribute.

## [2.3.2] 02.12.2019

Thanks to [Hostas](https://github.com/hontas) for following fixes:
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ Thanks to [hontas](https://github.com/hontas) for following fixes:
- [Fixed] Svelte V3: Improve type parsing for properties with default values.
- [Fixed] Svelte V3: In some cases `type` property was setup with wrong structure and data, now it fixed.

## [2.3.3] 05.12.2019

Thanks to [hontas](https://github.com/hontas) for following changes:

- [Added] Svelte V3: Implement component documentation parsing provided by top level comment in HTML markup or in the JS section, marked with `@component` JSDoc attribute.

Full changelog of release versions can be found [here](/CHANGELOG.md)

## Install
Expand All @@ -37,7 +43,7 @@ npm install --save sveltedoc-parser
- Support description extraction for everything items
- Support visibility scope from JSDoc keywords: `@public`, `@protected`, `@private`
- Extract global component description and keywords from JSDoc comment (_Svelte 3_)
- top level comment must include `@component`. [Example script](/test/svelte3/integration/globalComment/globalComment.script.svelte), [Example html](/test/svelte3/integration/globalComment/globalComment.markup.svelte)
- Top level comment must include `@component`. [Example script](/test/svelte3/integration/globalComment/globalComment.script.svelte), [Example html](/test/svelte3/integration/globalComment/globalComment.markup.svelte)
- Extract list of imported components
- Extract relative path to imported component (supports full-syntax and short-syntax import styles)
- Extract data properties
Expand Down
12 changes: 7 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function buildSvelteParser(structure, options, version) {
throw new Error(`Svelte V${version} is not supported`);
}

throw new Error(`Undefined Svelte version is not supported, you should specify default version in options`);
throw new Error('Undefined Svelte version is not supported, you should specify default version in options');
}

function getEventName(feature) {
Expand Down Expand Up @@ -126,7 +126,7 @@ function subscribeOnParserEvents(parser, options, version, resolve, reject) {
parser.on(feature, (value) => (component[feature] = value));
break;

default:
default: {
component[feature] = [];

const eventName = getEventName(feature);
Expand All @@ -138,9 +138,11 @@ function subscribeOnParserEvents(parser, options, version, resolve, reject) {
component[feature].push(value);
} else {
const currentItem = component[feature][itemIndex];

component[feature][itemIndex] = mergeItems(feature, currentItem, value);
}
});
}
}
});

Expand All @@ -166,12 +168,12 @@ module.exports.parse = (options) => new Promise((resolve, reject) => {
validateOptions(options);
normalizeOptions(options);

const structure = loadFileStructureFromOptions(options);
const structure = loadFileStructureFromOptions(options);

const version = options.version || SvelteVersionDetector.detectVersionFromStructure(structure, options.defaultVersion);

const parser = buildSvelteParser(structure, options, version);

subscribeOnParserEvents(parser, options, version, resolve, reject);

parser.walk();
Expand All @@ -181,7 +183,7 @@ module.exports.parse = (options) => new Promise((resolve, reject) => {
});

module.exports.detectVersion = (options) => {
validateOptions(options);
validateOptions(options);

return SvelteVersionDetector.detectVersionFromOptions(options);
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "sveltedoc-parser",
"version": "2.3.2",
"version": "2.3.3",
"description": "Generate a JSON documentation for a Svelte file",
"main": "index.js",
"scripts": {
"lint": "eslint ./*.js",
"test": "mocha ./test/**/*.spec.js",
"test:unit": "mocha ./test/unit/**/*.spec.js",
"test:integration": "mocha ./test/**/integration/**/*.spec.js",
Expand Down
Loading

0 comments on commit 7f3143e

Please sign in to comment.