Skip to content

Commit

Permalink
reorganized code
Browse files Browse the repository at this point in the history
  • Loading branch information
georghinkel committed Jun 12, 2024
1 parent eed8047 commit f0878ec
Show file tree
Hide file tree
Showing 109 changed files with 20,154 additions and 5,266 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
insert_final_newline = true
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.js
*.mjs
*.monarch.ts
71 changes: 71 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"header"
],
"ignorePatterns": [
"**/{node_modules,lib,bin}"
],
"rules": {
// List of [ESLint rules](https://eslint.org/docs/rules/)
"arrow-parens": ["off", "as-needed"], // do not force arrow function parentheses
"constructor-super": "error", // checks the correct use of super() in sub-classes
"dot-notation": "error", // obj.a instead of obj['a'] when possible
"eqeqeq": "error", // ban '==', don't use 'smart' option!
"guard-for-in": "error", // needs obj.hasOwnProperty(key) checks
"new-parens": "error", // new Error() instead of new Error
"no-bitwise": "error", // bitwise operators &, | can be confused with &&, ||
"no-caller": "error", // ECMAScript deprecated arguments.caller and arguments.callee
"no-cond-assign": "error", // assignments if (a = '1') are error-prone
"no-debugger": "error", // disallow debugger; statements
"no-eval": "error", // eval is considered unsafe
"no-inner-declarations": "off", // we need to have 'namespace' functions when using TS 'export ='
"no-labels": "error", // GOTO is only used in BASIC ;)
"no-multiple-empty-lines": ["error", {"max": 1}], // two or more empty lines need to be fused to one
"no-new-wrappers": "error", // there is no reason to wrap primitve values
"no-throw-literal": "error", // only throw Error but no objects {}
"no-trailing-spaces": "error", // trim end of lines
"no-unsafe-finally": "error", // safe try/catch/finally behavior
"no-var": "error", // use const and let instead of var
"space-before-function-paren": ["error", { // space in function decl: f() vs async () => {}
"anonymous": "never",
"asyncArrow": "always",
"named": "never"
}],
"semi": [2, "always"], // Always use semicolons at end of statement
"quotes": [2, "single", { "avoidEscape": true }], // Prefer single quotes
"use-isnan": "error", // isNaN(i) Number.isNaN(i) instead of i === NaN
// List of [@typescript-eslint rules](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules)
"@typescript-eslint/adjacent-overload-signatures": "error", // grouping same method names
"@typescript-eslint/array-type": ["error", { // string[] instead of Array<string>
"default": "array-simple"
}],
"@typescript-eslint/ban-types": "error", // bans types like String in favor of string
"@typescript-eslint/no-inferrable-types": "off", // don't blame decls like "index: number = 0", esp. in api signatures!
"@typescript-eslint/indent": "error", // consistent indentation
"@typescript-eslint/no-explicit-any": "error", // don't use :any type
"@typescript-eslint/no-misused-new": "error", // no constructors for interfaces or new for classes
"@typescript-eslint/no-namespace": "off", // disallow the use of custom TypeScript modules and namespaces
"@typescript-eslint/no-non-null-assertion": "off", // allow ! operator
"@typescript-eslint/parameter-properties": "error", // no property definitions in class constructors
"@typescript-eslint/no-unused-vars": ["error", { // disallow Unused Variables
"argsIgnorePattern": "^_"
}],
"@typescript-eslint/no-var-requires": "error", // use import instead of require
"@typescript-eslint/prefer-for-of": "error", // prefer for-of loop over arrays
"@typescript-eslint/prefer-namespace-keyword": "error", // prefer namespace over module in TypeScript
"@typescript-eslint/triple-slash-reference": "error", // ban /// <reference />, prefer imports
"@typescript-eslint/type-annotation-spacing": "error", // consistent space around colon ':'
"@typescript-eslint/consistent-type-imports": "error" // use import type whenever import is only used for type checking
}
}
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# For the following file types, normalize line endings to LF on
# checkin and prevent conversion to CRLF when they are checked out
# (this is required in order to prevent newline related issues like,
# for example, after the build script is run)
**/bin/*.js text eol=lf
.sh text eol=lf
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: "Bug report"
about: Report a reproducible bug or regression.
labels: 'bug'

---

<!--
Please provide a clear and concise description of what the bug is. Include
screenshots if needed. Please test using the latest version of the relevant
Langium packages to make sure your issue has not already been fixed.
-->

Langium version:
Package name:

## Steps To Reproduce

1.
2.

<!--
Your bug will get fixed much faster if we can run your code and it doesn't
have dependencies other than Langium. Issues without reproduction steps or
code examples may be immediately closed as not actionable.
-->

Link to code example:

<!--
Please provide a link to a repository on GitHub or provide a minimal code
example that reproduces the problem. You may provide a screenshot of some
application if you think it is relevant to your bug report. Here are some
tips for providing a minimal example: https://stackoverflow.com/help/mcve.
-->

## The current behavior


## The expected behavior
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Question
url: https://github.com/TypeFox/langium/discussions
about: Please ask questions here.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Feature request
about: Suggest an idea for this project
labels: 'feature-request'

---
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Describe the feature you'd like. -->
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: General improvement
about: Suggest an improvement for this project

---
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Describe the improvement you'd like to see in the project. -->
60 changes: 60 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Langium CI (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Build
shell: bash
run: |
npm ci
npm run build:clean
npm run validate-exports
- name: Test
if: success() || failure()
shell: bash
run: |
npm run test
lint:
name: Langium Lint
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Build
shell: bash
run: |
npm ci
npm run build:clean
npm run langium:generate
- name: Check Git Status
shell: bash
run: git diff --exit-code .
- name: Lint
shell: bash
run: npm run lint
57 changes: 57 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish

permissions:
id-token: write

on:
release:
types: [published]

jobs:
publish:
name: Langium Publish
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Build
shell: bash
run: |
npm ci
npm run build:clean
npm run langium:generate:production --workspace=langium
npm run build
- name: Test
if: success() || failure()
shell: bash
run: |
npm run test
- name: Publish NPM Packages
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Update the following list when a new npm package is added
run: |
npm run publish:latest --provenance --workspace=langium
npm run publish:latest --provenance --workspace=langium-railroad
npm run publish:latest --provenance --workspace=langium-cli
npm run publish:latest --provenance --workspace=langium-sprotty
npm run publish:latest --provenance --workspace=generator-langium
npm run publish:latest --provenance --workspace=langium-arithmetics-dsl
npm run publish:latest --provenance --workspace=langium-domainmodel-dsl
npm run publish:latest --provenance --workspace=langium-statemachine-dsl
- name: Publish VSCode Extension
shell: bash
run: |
npm install -g @vscode/vsce ovsx
cd packages/langium-vscode
PACKAGE_VERSION=`npm pkg get version --workspaces=false | tr -d \"`
vsce package
vsce publish -i langium-vscode-$PACKAGE_VERSION.vsix -p ${{ secrets.VSCE_TOKEN }}
ovsx publish langium-vscode-$PACKAGE_VERSION.vsix -p ${{ secrets.OVSX_TOKEN }}
14 changes: 10 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
node_modules/
*.tsbuildinfo
lib/
dist/
.DS_Store
.vscode-test/
coverage/
dist/
lib/
out/
node_modules/
*.vsix
*.tsbuildinfo
backend/
11 changes: 11 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tasks:
- init: npm install && npm run build
command: npm run watch

ports:
- port: 6000-6999
onOpen: ignore

vscode:
extensions:
- nmf.nmf-vscode
5 changes: 5 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"first-line-h1": false,
"line-length": false,
"no-inline-html": false
}
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"langium.langium-vscode",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"vitest.explorer"
]
}
Loading

0 comments on commit f0878ec

Please sign in to comment.