Skip to content
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

Static Typing with TypeScript (WIP) #619

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const { getBaseConfig } = require('@edx/frontend-build');

const config = getBaseConfig('eslint');

// Enable the eslint-plugin-jsdoc plugin
config.extends = ['@edx/eslint-config', 'plugin:jsdoc/recommended-typescript-flavor'];
config.plugins = [...(config.plugins ?? []), 'jsdoc'];
config.settings = {
...config.settings,
jsdoc: { mode: 'typescript', preferredTypes: { object: 'Object' } },
};

config.rules = {
'import/no-extraneous-dependencies': ['error', {
devDependencies: [
'**/*.config.js',
'**/*.test.jsx',
'**/*.test.js',
'example/*',
],
}],
'import/extensions': ['error', 'always', {
ignorePackages: true,
}],
'import/no-unresolved': ['error', {
ignore: ['@edx/frontend-platform*'],
}],
'jsx-a11y/anchor-is-valid': ['error', {
components: ['Link'],
specialLink: ['to'],
aspects: ['noHref', 'invalidHref', 'preferButton'],
}],
// There are too many missing descriptions to turn this on at the moment :/
'jsdoc/require-property-description': ['off'],
'jsdoc/require-param-description': ['off'],
'jsdoc/require-returns-description': ['off'],
'jsdoc/check-types': ['warn'],
'jsdoc/tag-lines': ['off'],
};

module.exports = config;
28 changes: 0 additions & 28 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.vscode
coverage
dist
types
node_modules
/docs/api
.env.private
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ doc_command = ./node_modules/.bin/documentation build src -g -c ./docs/documenta
cat_docs_command = cat ./docs/_API-header.md ./docs/_API-body.md > ./docs/API.md

build:
rm -rf ./dist
./node_modules/.bin/fedx-scripts babel src --out-dir dist --source-maps --ignore **/*.test.jsx,**/*.test.js,**/setupTest.js --copy-files
@# --copy-files will bring in everything else that wasn't processed by babel. Remove what we don't want.
@find dist -name '*.test.js*' -delete
rm ./dist/setupTest.js
cp ./package.json ./dist/package.json
cp ./LICENSE ./dist/LICENSE
cp ./README.md ./dist/README.md
rm -rf types/*
npx tsc

docs-build:
${doc_command}
Expand Down
File renamed without changes.
10 changes: 0 additions & 10 deletions docs/addTagsPlugin.js

This file was deleted.

24 changes: 0 additions & 24 deletions docs/removeExport.js

This file was deleted.

12 changes: 0 additions & 12 deletions docs/template/edx/README.md

This file was deleted.