Skip to content

Commit

Permalink
Merge pull request #10522 from archesproject/10516-cbyrd-adds-vue-typ…
Browse files Browse the repository at this point in the history
…escript-support-and-linter

Adds typescript support and vue/typescript linting #10516
  • Loading branch information
apeters authored Feb 1, 2024
2 parents 0233720 + e8adc39 commit 0c39a07
Show file tree
Hide file tree
Showing 36 changed files with 1,085 additions and 424 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
65 changes: 65 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
module.exports = {
"extends": [
"eslint:recommended",
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
],
"root": true,
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module",
"requireConfigFile": false,
"parser": {
"ts": "@typescript-eslint/parser"
}
},
"globals": {
"define": false,
"require": false,
"window": false,
"console": false,
"history": false,
"location": false,
"Promise": false,
"setTimeout": false,
"URL": false,
"URLSearchParams": false,
"fetch": false
},
"ignorePatterns": [".eslintrc.js", "**/media/plugins/*"],
"rules": {
"semi": ["error", "always"],
},
"overrides": [
{
"files": [ "*.vue" ],
"rules": {
"vue/html-indent": [2, 4],
"vue/this-in-template": "off"
}
},
{
"files": [ "*.js" ],
"rules": {
"indent": ["error", 4],
"space-before-function-paren": ["error", "never"],
"no-extra-boolean-cast": 0, // 0=silence, 1=warning, 2=error
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-unused-vars': [1, {
argsIgnorePattern: '^_'
}],
"camelcase": [1, {"properties": "always"}],
}
}
]
};

File renamed without changes.
44 changes: 0 additions & 44 deletions arches/.eslintrc.js

This file was deleted.

72 changes: 72 additions & 0 deletions arches/app/src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// import declarations from other projects or Arches core

// declare modules that have been added to your project (should mirror `package.json`)
declare module 'arches';
declare module "@babel/runtime";
declare module "@mapbox/geojson-extent";
declare module "@mapbox/geojsonhint";
declare module "@mapbox/mapbox-gl-draw";
declare module "@mapbox/mapbox-gl-geocoder";
declare module "@tmcw/togeojson";
declare module "@turf/turf";
declare module "backbone";
declare module "bootstrap";
declare module "bootstrap-colorpicker";
declare module "chosen-js";
declare module "ckeditor4";
declare module "codemirror";
declare module "core-js";
declare module "cross-env";
declare module "cross-fetch";
declare module "cytoscape";
declare module "cytoscape-cola";
declare module "d3";
declare module "datatables.net";
declare module "datatables.net-bs";
declare module "datatables.net-buttons";
declare module "datatables.net-buttons-bs";
declare module "datatables.net-responsive";
declare module "datatables.net-responsive-bs";
declare module "dom4";
declare module "dropzone";
declare module "eonasdan-bootstrap-datetimepicker";
declare module "font-awesome";
declare module "ionicons";
declare module "jqtree";
declare module "jquery";
declare module "jquery-migrate";
declare module "jquery-validation";
declare module "jqueryui";
declare module "js-cookie";
declare module "knockout";
declare module "knockout-mapping";
declare module "knockstrap";
declare module "latlon-geohash";
declare module "leaflet";
declare module "leaflet-draw";
declare module "leaflet-iiif";
declare module "leaflet.fullscreen";
declare module "lt-themify-icons";
declare module "mapbox-gl";
declare module "metismenu";
declare module "moment";
declare module "moment-timezone";
declare module "nouislider";
declare module "numeral";
declare module "primevue";
declare module "proj4";
declare module "regenerator-runtime";
declare module "requirejs";
declare module "requirejs-plugins";
declare module "requirejs-text";
declare module "select-woo";
declare module "select2";
declare module "underscore";
declare module "uuidjs";
declare module "vue";
declare module "vue3-gettext";
declare module "webpack-bundle-tracker";

// declare filetypes used in `./src/` folder
declare module '*.ts';
declare module '*.vue';
18 changes: 18 additions & 0 deletions arches/install/arches-admin
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ parser_startproject.add_argument(
type=str,
default='',
)
parser_startproject.add_argument(
'--exclude', '-x',
default='.git', # defaulting to `.git` here so hidden directories such as `.github` will be copied over
nargs='?',
help=(
'The directory name(s) to exclude, in addition to .git and '
'__pycache__. Can be used multiple times.'
),
)

parser_startapp = subparsers.add_parser(
'startapp',
Expand Down Expand Up @@ -107,6 +116,15 @@ parser_startapp.add_argument(
type=str,
default='',
)
parser_startapp.add_argument(
'--exclude', '-x',
default='.git', # defaulting to `.git` here so hidden directories such as `.github` will be copied over
nargs='?',
help=(
'The directory name(s) to exclude, in addition to .git and '
'__pycache__. Can be used multiple times.'
),
)

class ArchesProjectCommand(TemplateCommand):
help = (
Expand Down
1 change: 1 addition & 0 deletions arches/install/arches-app-templates/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!.eslintrc.js
65 changes: 65 additions & 0 deletions arches/install/arches-app-templates/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
module.exports = {
"extends": [
"eslint:recommended",
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
],
"root": true,
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module",
"requireConfigFile": false,
"parser": {
"ts": "@typescript-eslint/parser"
}
},
"globals": {
"define": false,
"require": false,
"window": false,
"console": false,
"history": false,
"location": false,
"Promise": false,
"setTimeout": false,
"URL": false,
"URLSearchParams": false,
"fetch": false
},
"ignorePatterns": [".eslintrc.js", "**/media/plugins/*"],
"rules": {
"semi": ["error", "always"],
},
"overrides": [
{
"files": [ "*.vue" ],
"rules": {
"vue/html-indent": [2, 4],
"vue/this-in-template": "off"
}
},
{
"files": [ "*.js" ],
"rules": {
"indent": ["error", 4],
"space-before-function-paren": ["error", "never"],
"no-extra-boolean-cast": 0, // 0=silence, 1=warning, 2=error
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-unused-vars': [1, {
argsIgnorePattern: '^_'
}],
"camelcase": [1, {"properties": "always"}],
}
}
]
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// import declarations from other projects or Arches core
import('../media/node_modules/arches/declarations.d.ts');

// declare modules that have been added to your project (should mirror dependencies in `package.json`)
declare module 'arches';

// declare filetypes used in `./src/` folder
declare module '*.vue';
declare module '*.ts';
5 changes: 5 additions & 0 deletions arches/install/arches-app-templates/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"events": {
"start": "clear"
}
}
11 changes: 10 additions & 1 deletion arches/install/arches-app-templates/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
{
"name": "{{ app_name }}",
"version": "0.0.1",
"license": "AGPL-3.0-only",
"scripts": {
"eslint:check": "./{{ app_name }}/media/node_modules/.bin/eslint ./{{ app_name }}/src --resolve-plugins-relative-to ./{{ app_name }}/media --ext .vue,.ts --parser ./{{ app_name }}/media/node_modules/vue-eslint-parser/index.js",
"eslint:watch": "./{{ app_name }}/media/node_modules/.bin/nodemon --watch ./{{ app_name }}/src --ext ts,vue --exec yarn --silent eslint:check",
"gettext:extract": "./{{ app_name }}/media/node_modules/.bin/vue-gettext-extract",
"gettext:compile": "./{{ app_name }}/media/node_modules/.bin/vue-gettext-compile"
"gettext:compile": "./{{ app_name }}/media/node_modules/.bin/vue-gettext-compile",
"ts:check": "./{{ app_name }}/media/node_modules/.bin/vue-tsc --noEmit",
"ts:watch": "./{{ app_name }}/media/node_modules/.bin/vue-tsc --watch --noEmit"
},
"dependencies": {
"vue": "^3.3.4",
"vue3-gettext": "^3.0.0-beta.4"
},
"devDependencies": {
"arches-dev-dependencies": "archesproject/arches-dev-dependencies#{{ arches_version }}"
},
"nodeModulesPaths": {
},
"resolutions": {
"node-gyp": "^10.0.0"
}
}
29 changes: 29 additions & 0 deletions arches/install/arches-app-templates/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"noEmit": true,
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"jsx": "preserve",
"jsxImportSource": "vue",
"noImplicitThis": false,
"strict": true,
"verbatimModuleSyntax": true,
"target": "ESNext",
"useDefineForClassFields": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"baseUrl": "./{{ app_name }}/src/",
"paths": {
"@/*": [
"*.ts",
"*.vue",
],
},
},
"include": [
"**/*.ts",
"**/*.vue",
],
}
10 changes: 10 additions & 0 deletions arches/install/arches-project
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ parser_start.add_argument(
type=str,
default='',)

parser_start.add_argument(
'--exclude', '-x',
default='.git', # defaulting to `.git` here so hidden directories such as `.github` will be copied over
nargs='?',
help=(
'The directory name(s) to exclude, in addition to .git and '
'__pycache__. Can be used multiple times.'
),
)

parser.add_argument('-v', '--verbosity', action='store', dest='verbosity', default='1',
type=int, choices=[0, 1, 2, 3],
help='Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output')
Expand Down
Loading

0 comments on commit 0c39a07

Please sign in to comment.