Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
init gherkin linter project
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Dec 7, 2021
0 parents commit 70c0e99
Show file tree
Hide file tree
Showing 19 changed files with 949 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"browser": false,
"commonjs": true,
"es6": true,
"node": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 2018,
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn"
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.vscode-test/
*.vsix
*.log
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 4,
"singleQuote": true,
"printWidth": 120,
"semi": true
}
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint"]
}
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"]
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/test/suite/index"
]
}
]
}
9 changes: 9 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.vscode/**
.vscode-test/**
test/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/jsconfig.json
**/*.map
**/.eslintrc.json
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ignore-engines true
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.0.1] - 2021-11-14

### Added

### Changed

### Removed
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## GherLint
34 changes: 34 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "gherlint",
"displayName": "GherLint",
"description": "Formatter and Linter for Gherkin language",
"version": "0.0.1",
"engines": {
"vscode": "^1.62.0"
},
"publisher": "sawjan",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/JankariTech/GherkinLinter.git"
},
"bugs": {
"url": "https://github.com/JankariTech/GherkinLinter.git/issues"
},
"author": "Sawjan G.",
"categories": [
"Programming Languages"
],
"keywords": [
"gherkin",
"cucumber",
"feature",
"bdd"
],
"dependencies": {
"vscode-languageclient": "^7.0.0"
},
"devDependencies": {
"vscode": "^1.1.37"
}
}
60 changes: 60 additions & 0 deletions client/src/extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const path = require('path');
const { workspace } = require('vscode');
const { LanguageClient, TransportKind } = require('vscode-languageclient/node');

let client;

function activate(context) {
console.log('gherlint extension started...');
// The server is implemented in node
const serverModule = context.asAbsolutePath(path.join('server', 'src', 'server.js'));

// The debug options for the server
// '--inspect=6009' runs the server in Node's Inspector mode
// so VS Code can attach to the server for debugging
const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] };

// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
const serverOptions = {
run: { module: serverModule, transport: TransportKind.ipc },
debug: {
module: serverModule,
transport: TransportKind.ipc,
options: debugOptions,
},
};

// Options to control the language client
const clientOptions = {
// Register the server for .feature files
documentSelector: [{ scheme: 'file', language: 'gherkin' }],
synchronize: {
// Notify the server about file changes to '.clientrc files contained in the workspace
fileEvents: workspace.createFileSystemWatcher('**/.clientrc'),
},
};

// Create the language client.
client = new LanguageClient(
'gherkinlinter_client',
'Linter and formatter for feature files',
serverOptions,
clientOptions
);

// Start the client. This will also launch the server
client.start();
}

function deactivate() {
if (!client) {
return undefined;
}
return client.stop();
}

module.exports = {
activate,
deactivate,
};
Loading

0 comments on commit 70c0e99

Please sign in to comment.