Skip to content

Commit

Permalink
Drop remaining coffee use
Browse files Browse the repository at this point in the history
This basically commits the transpiled CoffeeScript JS (with minor
cleanup) and removes coffee build support.

A tiny amount of support for xblocks exists, because external users
may have xblocks with coffee. But no coffee in our tree anyway.
  • Loading branch information
mikix committed Apr 13, 2018
1 parent 2abbd1e commit a34c8c8
Show file tree
Hide file tree
Showing 107 changed files with 3,542 additions and 2,698 deletions.
52 changes: 29 additions & 23 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ test_root/staticfiles
common/static/xmodule


# Coffeescript directories (don't lint autogenerated files)
cms/static/coffee
lms/static/coffee
common/static/coffee
common/lib/capa/capa/tests/test_files/js


# Symlinks into common/lib/xmodule/xmodule/js
cms/static/xmodule_js
lms/static/xmodule_js
Expand All @@ -36,27 +29,40 @@ lms/static/xmodule_js
cms/djangoapps/pipeline_js/templates


# This directory is about half Coffee and half JS, things get messy here so just ignore all existing coffee paths
# These are es2015 spec files that used to be in an ignored path.
# Now they live with the rest of the code, but we want to ignore them
# until the surrounding code is es2015 and we have a chance to clean them.
# We need to ignore them here, because es2015 will cause a parse error
# even if we add an eslint-disable line to the file.
cms/static/js/spec/models/course_spec.js
cms/static/js/spec/models/metadata_spec.js
cms/static/js/spec/models/section_spec.js
cms/static/js/spec/models/settings_course_grader_spec.js
cms/static/js/spec/models/settings_grading_spec.js
cms/static/js/spec/models/textbook_spec.js
cms/static/js/spec/models/upload_spec.js
cms/static/js/spec/views/assets_squire_spec.js
cms/static/js/spec/views/course_info_spec.js
cms/static/js/spec/views/metadata_edit_spec.js
cms/static/js/spec/views/textbook_spec.js
cms/static/js/spec/views/upload_spec.js
common/lib/capa/capa/tests/test_files/js/test_problem_display.js
common/lib/capa/capa/tests/test_files/js/test_problem_generator.js
common/lib/capa/capa/tests/test_files/js/test_problem_grader.js
common/lib/capa/capa/tests/test_files/js/xproblem.js
common/lib/xmodule/xmodule/js/spec/annotatable/display_spec.js
common/lib/xmodule/xmodule/js/spec/capa/display_spec.js
common/lib/xmodule/xmodule/js/spec/html/edit_spec.js
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.js
common/lib/xmodule/xmodule/js/spec/problem/edit_spec_hint.js
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.js
common/lib/xmodule/xmodule/js/spec/tabs/edit.js
lms/static/js/spec/calculator_spec.js
lms/static/js/spec/courseware_spec.js
lms/static/js/spec/feedback_form_spec.js
lms/static/js/spec/helper.js
lms/static/js/spec/histogram_spec.js
lms/static/js/spec/modules/tab_spec.js
lms/static/js/spec/requirejs_spec.js

common/lib/xmodule/xmodule/js/src/annotatable/display.js
common/lib/xmodule/xmodule/js/src/conditional/display.js
common/lib/xmodule/xmodule/js/src/discussion/display.js
common/lib/xmodule/xmodule/js/src/html/display.js
common/lib/xmodule/xmodule/js/src/html/edit.js
common/lib/xmodule/xmodule/js/src/raw/edit/json.js
common/lib/xmodule/xmodule/js/src/raw/edit/metadata-only.js
common/lib/xmodule/xmodule/js/src/raw/edit/xml.js
common/lib/xmodule/xmodule/js/src/sequence/edit.js
common/lib/xmodule/xmodule/js/src/tabs/tabs-aggregator.js
common/lib/xmodule/xmodule/js/src/vertical/edit.js

# This file is responsible for almost half of the repo's total issues.
common/lib/xmodule/xmodule/js/src/capa/schematic.js

!**/.eslintrc.js
9 changes: 1 addition & 8 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,10 +810,7 @@
},
}

PIPELINE_COMPILERS = (
'pipeline.compilers.coffee.CoffeeScriptCompiler',
)

PIPELINE_COMPILERS = ()
PIPELINE_CSS_COMPRESSOR = None
PIPELINE_JS_COMPRESSOR = None

Expand All @@ -829,10 +826,6 @@
"sass/*/*.scss",
"sass/*/*/*.scss",
"sass/*/*/*/*.scss",
"coffee/*.coffee",
"coffee/*/*.coffee",
"coffee/*/*/*.coffee",
"coffee/*/*/*/*.coffee",

# Ignore tests
"spec",
Expand Down
6 changes: 3 additions & 3 deletions cms/static/cms/js/require-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
'jquery.fileupload-validate': 'js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate',
'jquery.iframe-transport': 'js/vendor/jQuery-File-Upload/js/jquery.iframe-transport',
'jquery.inputnumber': 'js/vendor/html5-input-polyfills/number-polyfill',
'jquery.immediateDescendents': 'coffee/src/jquery.immediateDescendents',
'jquery.immediateDescendents': 'js/src/jquery.immediateDescendents',
'datepair': 'js/vendor/timepicker/datepair',
'date': 'js/vendor/date',
moment: 'common/js/vendor/moment-with-locales',
Expand Down Expand Up @@ -304,11 +304,11 @@
deps: ['xblock/core']
},
'cms/js/main': {
deps: ['coffee/src/ajax_prefix']
deps: ['js/src/ajax_prefix']
},
'js/src/logger': {
exports: 'Logger',
deps: ['coffee/src/ajax_prefix']
deps: ['js/src/ajax_prefix']
},

// the following are all needed for annotation tools
Expand Down
30 changes: 15 additions & 15 deletions cms/static/cms/js/spec/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
'jquery.fileupload-validate': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate', // eslint-disable-line max-len
'jquery.iframe-transport': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.iframe-transport', // eslint-disable-line max-len
'jquery.inputnumber': 'xmodule_js/common_static/js/vendor/html5-input-polyfills/number-polyfill',
'jquery.immediateDescendents': 'xmodule_js/common_static/coffee/src/jquery.immediateDescendents',
'jquery.immediateDescendents': 'xmodule_js/common_static/js/src/jquery.immediateDescendents',
'jquery.simulate': 'xmodule_js/common_static/js/vendor/jquery.simulate',
'datepair': 'xmodule_js/common_static/js/vendor/timepicker/datepair',
'date': 'xmodule_js/common_static/js/vendor/date',
Expand Down Expand Up @@ -72,7 +72,7 @@
'mock-ajax': 'xmodule_js/common_static/js/vendor/mock-ajax',
mathjax: '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // eslint-disable-line max-len
'youtube': '//www.youtube.com/player_api?noext',
'coffee/src/ajax_prefix': 'xmodule_js/common_static/coffee/src/ajax_prefix',
'js/src/ajax_prefix': 'xmodule_js/common_static/js/src/ajax_prefix',
'js/spec/test_utils': 'js/spec/test_utils'
},
shim: {
Expand Down Expand Up @@ -218,9 +218,9 @@
deps: ['jquery']
},
'cms/js/main': {
deps: ['coffee/src/ajax_prefix']
deps: ['js/src/ajax_prefix']
},
'coffee/src/ajax_prefix': {
'js/src/ajax_prefix': {
deps: ['jquery']
}
}
Expand All @@ -231,17 +231,17 @@
testFiles = [
'cms/js/spec/main_spec',
'cms/js/spec/xblock/cms.runtime.v1_spec',
'coffee/spec/models/course_spec',
'coffee/spec/models/metadata_spec',
'coffee/spec/models/section_spec',
'coffee/spec/models/settings_course_grader_spec',
'coffee/spec/models/settings_grading_spec',
'coffee/spec/models/textbook_spec',
'coffee/spec/models/upload_spec',
'coffee/spec/views/course_info_spec',
'coffee/spec/views/metadata_edit_spec',
'coffee/spec/views/textbook_spec',
'coffee/spec/views/upload_spec',
'js/spec/models/course_spec',
'js/spec/models/metadata_spec',
'js/spec/models/section_spec',
'js/spec/models/settings_course_grader_spec',
'js/spec/models/settings_grading_spec',
'js/spec/models/textbook_spec',
'js/spec/models/upload_spec',
'js/spec/views/course_info_spec',
'js/spec/views/metadata_edit_spec',
'js/spec/views/textbook_spec',
'js/spec/views/upload_spec',
'js/spec/video/transcripts/utils_spec',
'js/spec/video/transcripts/editor_spec',
'js/spec/video/transcripts/videolist_spec',
Expand Down
10 changes: 5 additions & 5 deletions cms/static/cms/js/spec/main_squire.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'jquery.fileupload-validate': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate', // eslint-disable-line max-len
'jquery.iframe-transport': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.iframe-transport', // eslint-disable-line max-len
'jquery.inputnumber': 'xmodule_js/common_static/js/vendor/html5-input-polyfills/number-polyfill',
'jquery.immediateDescendents': 'xmodule_js/common_static/coffee/src/jquery.immediateDescendents',
'jquery.immediateDescendents': 'xmodule_js/common_static/js/src/jquery.immediateDescendents',
'datepair': 'xmodule_js/common_static/js/vendor/timepicker/datepair',
'date': 'xmodule_js/common_static/js/vendor/date',
'text': 'xmodule_js/common_static/js/vendor/requirejs/text',
Expand All @@ -49,7 +49,7 @@
'URI': 'xmodule_js/common_static/js/vendor/URI.min',
mathjax: '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // eslint-disable-line max-len
'youtube': '//www.youtube.com/player_api?noext',
'coffee/src/ajax_prefix': 'xmodule_js/common_static/coffee/src/ajax_prefix'
'js/src/ajax_prefix': 'xmodule_js/common_static/js/src/ajax_prefix'
},
shim: {
'gettext': {
Expand Down Expand Up @@ -174,9 +174,9 @@
deps: ['xblock/core']
},
'cms/js/main': {
deps: ['coffee/src/ajax_prefix']
deps: ['js/src/ajax_prefix']
},
'coffee/src/ajax_prefix': {
'js/src/ajax_prefix': {
deps: ['jquery']
}
}
Expand All @@ -185,7 +185,7 @@
jasmine.getFixtures().fixturesPath = '/base/templates';

testFiles = [
'coffee/spec/views/assets_spec',
'js/spec/views/assets_squire_spec',
'js/spec/video/translations_editor_spec',
'js/spec/video/file_uploader_editor_spec',
'js/spec/models/group_configuration_spec'
Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/models/metadata.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define(['backbone'], function(Backbone) {
/**
* Model used for metadata setting editors. This model does not do its own saving,
* as that is done by module_edit.coffee.
* as that is done by module_edit.js.
*/
var Metadata = Backbone.Model.extend({
defaults: {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions cms/static/karma_cms.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ var options = {
// Otherwise Istanbul which is used for coverage tracking will cause tests to not run.
sourceFiles: [
{pattern: 'cms/**/!(*spec|djangojs).js'},
{pattern: 'coffee/src/**/!(*spec).js'},
{pattern: 'js/**/!(*spec|djangojs).js'}
],

specFiles: [
{pattern: 'cms/**/*spec.js'},
{pattern: 'coffee/spec/**/*spec.js'},
{pattern: 'js/certificates/spec/**/*spec.js'},
{pattern: 'js/spec/**/*spec.js'}
],
Expand Down
3 changes: 0 additions & 3 deletions cms/static/karma_cms_squire.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ var options = {
// Make sure the patterns in sourceFiles and specFiles do not match the same file.
// Otherwise Istanbul which is used for coverage tracking will cause tests to not run.
sourceFiles: [
{pattern: 'coffee/src/**/!(*spec).js'},
{pattern: 'cms/js/**/!(*spec|djangojs).js'},
{pattern: 'js/**/!(*spec|djangojs).js'}
],

specFiles: [
{pattern: 'coffee/spec/**/*spec.js'},
{pattern: 'js/spec/**/*spec.js'}
],

fixtureFiles: [
{pattern: 'coffee/fixtures/**/*.*'},
{pattern: 'templates/**/*.*'}
],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
*/

/* eslint-disable */
var MersenneTwister = function(seed) {
if (seed == undefined) {
seed = new Date().getTime();
Expand Down
6 changes: 2 additions & 4 deletions common/lib/xmodule/xmodule/annotatable_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ class AnnotatableFields(object):

class AnnotatableModule(AnnotatableFields, XModule):
js = {
'coffee': [
resource_string(__name__, 'js/src/html/display.coffee'),
resource_string(__name__, 'js/src/annotatable/display.coffee'),
],
'js': [
resource_string(__name__, 'js/src/html/display.js'),
resource_string(__name__, 'js/src/annotatable/display.js'),
resource_string(__name__, 'js/src/javascript_loader.js'),
resource_string(__name__, 'js/src/collapsible.js'),
]
Expand Down
4 changes: 1 addition & 3 deletions common/lib/xmodule/xmodule/conditional_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ class ConditionalModule(ConditionalFields, XModule, StudioEditableModule):
"""

js = {
'coffee': [
resource_string(__name__, 'js/src/conditional/display.coffee'),
],
'js': [
resource_string(__name__, 'js/src/conditional/display.js'),
resource_string(__name__, 'js/src/javascript_loader.js'),
resource_string(__name__, 'js/src/collapsible.js'),
]
Expand Down
10 changes: 5 additions & 5 deletions common/lib/xmodule/xmodule/editing_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class TabsEditingDescriptor(EditingFields, MakoModuleDescriptor):
"""
mako_template = "widgets/tabs-aggregator.html"
css = {'scss': [resource_string(__name__, 'css/tabs/tabs.scss')]}
js = {'coffee': [resource_string(
__name__, 'js/src/tabs/tabs-aggregator.coffee')]}
js = {'js': [resource_string(
__name__, 'js/src/tabs/tabs-aggregator.js')]}
js_module_name = "TabsEditingDescriptor"
tabs = []

Expand Down Expand Up @@ -93,7 +93,7 @@ class XMLEditingDescriptor(EditingDescriptor):

css = {'scss': [resource_string(__name__, 'css/codemirror/codemirror.scss')]}

js = {'coffee': [resource_string(__name__, 'js/src/raw/edit/xml.coffee')]}
js = {'js': [resource_string(__name__, 'js/src/raw/edit/xml.js')]}
js_module_name = "XMLEditingDescriptor"


Expand All @@ -103,7 +103,7 @@ class MetadataOnlyEditingDescriptor(EditingDescriptor):
not expose a UI for editing the module data
"""

js = {'coffee': [resource_string(__name__, 'js/src/raw/edit/metadata-only.coffee')]}
js = {'js': [resource_string(__name__, 'js/src/raw/edit/metadata-only.js')]}
js_module_name = "MetadataOnlyEditingDescriptor"

mako_template = "widgets/metadata-only-edit.html"
Expand All @@ -117,5 +117,5 @@ class JSONEditingDescriptor(EditingDescriptor):

css = {'scss': [resource_string(__name__, 'css/codemirror/codemirror.scss')]}

js = {'coffee': [resource_string(__name__, 'js/src/raw/edit/json.coffee')]}
js = {'js': [resource_string(__name__, 'js/src/raw/edit/json.js')]}
js_module_name = "JSONEditingDescriptor"
6 changes: 2 additions & 4 deletions common/lib/xmodule/xmodule/html_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,8 @@ class HtmlModuleMixin(HtmlBlock, XModule):
Attributes and methods used by HtmlModules internally.
"""
js = {
'coffee': [
resource_string(__name__, 'js/src/html/display.coffee'),
],
'js': [
resource_string(__name__, 'js/src/html/display.js'),
resource_string(__name__, 'js/src/javascript_loader.js'),
resource_string(__name__, 'js/src/collapsible.js'),
resource_string(__name__, 'js/src/html/imageModal.js'),
Expand Down Expand Up @@ -139,7 +137,7 @@ class HtmlDescriptor(HtmlBlock, XmlDescriptor, EditingDescriptor): # pylint: di
template_dir_name = "html"
show_in_read_only_mode = True

js = {'coffee': [resource_string(__name__, 'js/src/html/edit.coffee')]}
js = {'js': [resource_string(__name__, 'js/src/html/edit.js')]}
js_module_name = "HTMLEditingDescriptor"
css = {'scss': [resource_string(__name__, 'css/editor/edit.scss'), resource_string(__name__, 'css/html/edit.scss')]}

Expand Down
6 changes: 2 additions & 4 deletions common/lib/xmodule/xmodule/imageannotation_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ class AnnotatableFields(object):
class ImageAnnotationModule(AnnotatableFields, XModule):
'''Image Annotation Module'''
js = {
'coffee': [
resource_string(__name__, 'js/src/html/display.coffee'),
resource_string(__name__, 'js/src/annotatable/display.coffee'),
],
'js': [
resource_string(__name__, 'js/src/html/display.js'),
resource_string(__name__, 'js/src/annotatable/display.js'),
resource_string(__name__, 'js/src/javascript_loader.js'),
resource_string(__name__, 'js/src/collapsible.js'),
]
Expand Down
2 changes: 1 addition & 1 deletion common/lib/xmodule/xmodule/js/karma_xmodule.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var options = {
// Avoid adding files to this list. Use RequireJS.
libraryFilesToInclude: [
// Load the core JavaScript dependencies
{pattern: 'common_static/coffee/src/ajax_prefix.js', included: true},
{pattern: 'common_static/js/src/ajax_prefix.js', included: true},
{pattern: 'common_static/common/js/vendor/underscore.js', included: true},
{pattern: 'common_static/common/js/vendor/backbone.js', included: true},
{pattern: 'common_static/js/vendor/CodeMirror/codemirror.js', included: true},
Expand Down
2 changes: 1 addition & 1 deletion common/lib/xmodule/xmodule/js/spec/capa/display_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Problem', function() {
spyOn(SR, 'readText');
spyOn(SR, 'readTexts');

// Load this function from spec/helper.coffee
// Load this function from spec/helper.js
// Note that if your test fails with a message like:
// 'External request attempted for blah, which is not defined.'
// this msg is coming from the stubRequests function else clause.
Expand Down
2 changes: 0 additions & 2 deletions common/lib/xmodule/xmodule/js/spec/problem/edit_spec_hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,6 @@ hint
);

describe('Markdown to xml extended hint with tricky syntax cases', function() {
// I'm entering this as utf-8 in this file.
// I cannot find a way to set the encoding for .coffee files but it seems to work.
it('produces xml with unicode', function() {
const data = MarkdownEditingDescriptor.markdownToXml(`\
>>á and Ø<<
Expand Down
Loading

0 comments on commit a34c8c8

Please sign in to comment.