Skip to content

Eslint #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.js
test/**/index.ts
test/**/runTest.ts
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**@type {import('eslint').Linter.Config} */
// eslint-disable-next-line no-undef
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-jsdoc', 'eslint-plugin-import', 'prettier'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
rules: {
'semi': [2, 'always'],
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-non-null-assertion': 0,
},
};
2 changes: 2 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
run: yarn install
- name: Compile
run: yarn compile
- name: Linting
run: yarn lint
- name: Test Syntax Highlighting
run: yarn test:grammar
- name: Test Unittests
Expand Down
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# .prettierignore

node_modules
dist
out
15 changes: 15 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"jsxSingleQuote": false,
"quoteProps": "consistent",
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"endOfLine": "lf",
"embeddedLanguageFormatting": "auto"
}
6 changes: 0 additions & 6 deletions .prettierrc.js

This file was deleted.

8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
38 changes: 31 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
}
}
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.configPath": ".prettierrc"
}
8 changes: 7 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@
"isDefault": true
},
"detail": "setup for test launch"

},
{
"type": "npm",
"script": "lint",
"problemMatcher": "$eslint-stylish",
"label": "npm: lint",
"detail": "eslint . --ext .ts,.tsx"
}
]
}
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [2.4.3]

### Changed

- Changed from `tslint` to `eslint` and `prettier` to format ts, json, md files
([#260](https://github.com/krvajal/vscode-fortran-support/issues/260))

## [2.4.2]

### Fixed
Expand Down Expand Up @@ -299,7 +306,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Initial release

[unreleased]: https://github.com/krvajal/vscode-fortran-support/compare/v2.4.2...HEAD
[unreleased]: https://github.com/krvajal/vscode-fortran-support/compare/v2.4.3...HEAD
[2.4.3]: https://github.com/krvajal/vscode-fortran-support/compare/v2.4.2...v2.4.3
[2.4.2]: https://github.com/krvajal/vscode-fortran-support/compare/v2.4.1...v2.4.2
[2.4.1]: https://github.com/krvajal/vscode-fortran-support/compare/v2.4.0...v2.4.1
[2.4.0]: https://github.com/krvajal/vscode-fortran-support/compare/v2.3.0...v2.4.0
Expand Down
15 changes: 8 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#CONTRIBUTING
---
You *always* want to look at this file **before** contributing. In here you
# #CONTRIBUTING

You _always_ want to look at this file **before** contributing. In here you
should find steps that you need to take to set up your development environment
as well as instructions for coding standards and contribution guidelines.


## Setup instructions
First of all, this is a Visual Studio Code extension that uses TypeScript and tools based on [Node.js](https://nodejs.org/en/) with dependencies from npm. So you will need to have Node installed on your `$PATH`.

First of all, this is a Visual Studio Code extension that uses TypeScript and tools based on [Node.js](https://nodejs.org/en/) with dependencies from npm. So you will need to have Node installed on your `$PATH`.

1. Fork the repo
2. Clone your fork
3. Create a branch
4. Run `npm install`

4. Run `yarn install`
5. To test the extension run `yarn test:grammar && yarn test`
73 changes: 35 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,33 @@

You can control the include paths to be used by the linter with the `fortran.includePaths` setting.

``` jsonc
```jsonc
{
"fortran.includePaths": [
"/usr/local/include",
"/usr/local"
]
"fortran.includePaths": ["/usr/local/include", "/usr/local"]
}
```

By default the `gfortran` executable is assumed to be found in the path. In order to use a different one or if it can't be found in the path you can point the extension to use a custom one with the `fortran.gfortranExecutable` setting.

``` jsonc
```jsonc
{
"fortran.gfortranExecutable": "/usr/local/bin/gfortran-4.7",
"fortran.gfortranExecutable": "/usr/local/bin/gfortran-4.7"
}
```

If you want to pass extra options to the `gfortran` executable or override the default one, you can use the setting `fortran.linterExtraArgs`. By default `-Wall` is the only option.

``` jsonc
```jsonc
{
"fortran.linterExtraArgs": ["-Wall"],
"fortran.linterExtraArgs": ["-Wall"]
}
```

You can configure what kind of symbols will appear in the symbol list by using

``` jsonc
```jsonc
{
"fortran.symbols": [ "function", "subroutine"]
"fortran.symbols": ["function", "subroutine"]
}
```

Expand All @@ -69,7 +66,7 @@ and by default only functions and subroutines are shown

You can also configure the case for fortran intrinsics auto-complete by using

``` jsonc
```jsonc
{
"fortran.preferredCase": "lowercase" | "uppercase"
}
Expand All @@ -79,7 +76,7 @@ You can also configure the case for fortran intrinsics auto-complete by using

This is a list of some of the snippets included, if you like to include additional snippets please let me know and I will add them.

#### Program skeleton
### Program skeleton

![program snippet](https://media.giphy.com/media/OYdq9BKYMOOdy/giphy.gif)

Expand Down Expand Up @@ -110,33 +107,33 @@ More details about how to setup the debugger can be found in Microsoft's website
- C/C++ extension debugger information: <https://code.visualstudio.com/docs/cpp/cpp-debug>
- Build tasks for easy compiling: <https://code.visualstudio.com/docs/editor/tasks>

``` jsonc
```jsonc
{
// 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": [
// 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": "(gdb) Fortran",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [], // Possible input args for a.out
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"name": "(gdb) Fortran",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [], // Possible input args for a.out
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
]
}
]
}
```

Expand All @@ -148,7 +145,7 @@ For debugging you need to have one of the following debuggers installed:

- **Linux**: GDB
- **macOS**: GDB or LLDB
- **Windows**: GDB or Visual Studio Windows Debugger
- **Windows**: GDB or Visual Studio Windows Debugger

## Issues

Expand Down
16 changes: 8 additions & 8 deletions coverconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"enabled": true,
"relativeSourcePath": "../src",
"relativeCoverageDir": "../../coverage",
"ignorePatterns": ["**/node_modules/**"],
"includePid": false,
"reports": ["json", "html", "lcov"],
"verbose": false
}
"enabled": true,
"relativeSourcePath": "../src",
"relativeCoverageDir": "../../coverage",
"ignorePatterns": ["**/node_modules/**"],
"includePid": false,
"reports": ["json", "html", "lcov"],
"verbose": false
}
Loading